@coderwyd/eslint-config 1.1.0-beta.1 → 1.1.0-beta.2
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/README.md +230 -51
- package/dist/index.cjs +828 -645
- package/dist/index.d.cts +80 -28
- package/dist/index.d.ts +80 -28
- package/dist/index.js +803 -641
- package/package.json +8 -2
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,28 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
GLOB_ALL_SRC: () => GLOB_ALL_SRC,
|
|
34
|
+
GLOB_ASTRO: () => GLOB_ASTRO,
|
|
35
|
+
GLOB_CSS: () => GLOB_CSS,
|
|
36
|
+
GLOB_EXCLUDE: () => GLOB_EXCLUDE,
|
|
37
|
+
GLOB_HTML: () => GLOB_HTML,
|
|
38
|
+
GLOB_JS: () => GLOB_JS,
|
|
39
|
+
GLOB_JSON: () => GLOB_JSON,
|
|
40
|
+
GLOB_JSON5: () => GLOB_JSON5,
|
|
41
|
+
GLOB_JSONC: () => GLOB_JSONC,
|
|
42
|
+
GLOB_JSX: () => GLOB_JSX,
|
|
43
|
+
GLOB_LESS: () => GLOB_LESS,
|
|
44
|
+
GLOB_MARKDOWN: () => GLOB_MARKDOWN,
|
|
45
|
+
GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
|
|
46
|
+
GLOB_SCSS: () => GLOB_SCSS,
|
|
47
|
+
GLOB_SRC: () => GLOB_SRC,
|
|
48
|
+
GLOB_SRC_EXT: () => GLOB_SRC_EXT,
|
|
49
|
+
GLOB_STYLE: () => GLOB_STYLE,
|
|
50
|
+
GLOB_TESTS: () => GLOB_TESTS,
|
|
51
|
+
GLOB_TS: () => GLOB_TS,
|
|
52
|
+
GLOB_TSX: () => GLOB_TSX,
|
|
53
|
+
GLOB_VUE: () => GLOB_VUE,
|
|
54
|
+
GLOB_YAML: () => GLOB_YAML,
|
|
33
55
|
astro: () => astro,
|
|
34
56
|
coderwyd: () => coderwyd,
|
|
35
57
|
combine: () => combine,
|
|
@@ -47,7 +69,7 @@ __export(src_exports, {
|
|
|
47
69
|
parserJsonc: () => import_jsonc_eslint_parser.default,
|
|
48
70
|
parserTs: () => import_parser.default,
|
|
49
71
|
parserVue: () => import_vue_eslint_parser.default,
|
|
50
|
-
|
|
72
|
+
parserYaml: () => import_yaml_eslint_parser.default,
|
|
51
73
|
pluginAntfu: () => import_eslint_plugin_antfu.default,
|
|
52
74
|
pluginAstro: () => import_eslint_plugin_astro.default,
|
|
53
75
|
pluginComments: () => import_eslint_plugin_eslint_comments.default,
|
|
@@ -64,7 +86,7 @@ __export(src_exports, {
|
|
|
64
86
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
65
87
|
pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
|
|
66
88
|
pluginVue: () => import_eslint_plugin_vue.default,
|
|
67
|
-
|
|
89
|
+
pluginYaml: () => import_eslint_plugin_yml.default,
|
|
68
90
|
react: () => react,
|
|
69
91
|
renameRules: () => renameRules,
|
|
70
92
|
sortPackageJson: () => sortPackageJson,
|
|
@@ -72,10 +94,9 @@ __export(src_exports, {
|
|
|
72
94
|
stylistic: () => stylistic,
|
|
73
95
|
test: () => test,
|
|
74
96
|
typescript: () => typescript,
|
|
75
|
-
typescriptWithLanguageServer: () => typescriptWithLanguageServer,
|
|
76
97
|
unicorn: () => unicorn,
|
|
77
98
|
vue: () => vue,
|
|
78
|
-
|
|
99
|
+
yaml: () => yaml
|
|
79
100
|
});
|
|
80
101
|
module.exports = __toCommonJS(src_exports);
|
|
81
102
|
|
|
@@ -110,32 +131,40 @@ var import_jsonc_eslint_parser = __toESM(require("jsonc-eslint-parser"), 1);
|
|
|
110
131
|
var import_astro_eslint_parser = __toESM(require("astro-eslint-parser"), 1);
|
|
111
132
|
|
|
112
133
|
// src/configs/comments.ts
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
134
|
+
function comments() {
|
|
135
|
+
return [
|
|
136
|
+
{
|
|
137
|
+
plugins: {
|
|
138
|
+
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
139
|
+
},
|
|
140
|
+
rules: {
|
|
141
|
+
"eslint-comments/no-aggregating-enable": "error",
|
|
142
|
+
"eslint-comments/no-duplicate-disable": "error",
|
|
143
|
+
"eslint-comments/no-unlimited-disable": "error",
|
|
144
|
+
"eslint-comments/no-unused-enable": "error"
|
|
145
|
+
}
|
|
123
146
|
}
|
|
124
|
-
|
|
125
|
-
|
|
147
|
+
];
|
|
148
|
+
}
|
|
126
149
|
|
|
127
150
|
// src/globs.ts
|
|
128
151
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
129
152
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
153
|
+
var GLOB_JS = "**/*.?([cm])js";
|
|
130
154
|
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
131
155
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
132
156
|
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
157
|
+
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
158
|
+
var GLOB_CSS = "**/*.css";
|
|
159
|
+
var GLOB_LESS = "**/*.less";
|
|
160
|
+
var GLOB_SCSS = "**/*.scss";
|
|
133
161
|
var GLOB_JSON = "**/*.json";
|
|
134
162
|
var GLOB_JSON5 = "**/*.json5";
|
|
135
163
|
var GLOB_JSONC = "**/*.jsonc";
|
|
136
164
|
var GLOB_MARKDOWN = "**/*.md";
|
|
137
165
|
var GLOB_VUE = "**/*.vue";
|
|
138
166
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
167
|
+
var GLOB_HTML = "**/*.htm?(l)";
|
|
139
168
|
var GLOB_ASTRO = "**/*.astro";
|
|
140
169
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
141
170
|
var GLOB_TESTS = [
|
|
@@ -143,6 +172,16 @@ var GLOB_TESTS = [
|
|
|
143
172
|
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
144
173
|
`**/*.test.${GLOB_SRC_EXT}`
|
|
145
174
|
];
|
|
175
|
+
var GLOB_ALL_SRC = [
|
|
176
|
+
GLOB_SRC,
|
|
177
|
+
GLOB_STYLE,
|
|
178
|
+
GLOB_JSON,
|
|
179
|
+
GLOB_JSON5,
|
|
180
|
+
GLOB_MARKDOWN,
|
|
181
|
+
GLOB_VUE,
|
|
182
|
+
GLOB_YAML,
|
|
183
|
+
GLOB_HTML
|
|
184
|
+
];
|
|
146
185
|
var GLOB_EXCLUDE = [
|
|
147
186
|
"**/node_modules",
|
|
148
187
|
"**/dist",
|
|
@@ -168,29 +207,41 @@ var GLOB_EXCLUDE = [
|
|
|
168
207
|
];
|
|
169
208
|
|
|
170
209
|
// src/configs/ignores.ts
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
210
|
+
function ignores() {
|
|
211
|
+
return [
|
|
212
|
+
{ ignores: GLOB_EXCLUDE }
|
|
213
|
+
];
|
|
214
|
+
}
|
|
174
215
|
|
|
175
216
|
// src/configs/imports.ts
|
|
176
|
-
|
|
177
|
-
{
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
217
|
+
function imports(options = {}) {
|
|
218
|
+
const {
|
|
219
|
+
stylistic: stylistic2 = true
|
|
220
|
+
} = options;
|
|
221
|
+
return [
|
|
222
|
+
{
|
|
223
|
+
plugins: {
|
|
224
|
+
antfu: import_eslint_plugin_antfu.default,
|
|
225
|
+
import: import_eslint_plugin_i.default
|
|
226
|
+
},
|
|
227
|
+
rules: {
|
|
228
|
+
"antfu/import-dedupe": "error",
|
|
229
|
+
"antfu/no-import-node-modules-by-path": "error",
|
|
230
|
+
"import/export": "error",
|
|
231
|
+
"import/first": "error",
|
|
232
|
+
"import/no-duplicates": "error",
|
|
233
|
+
"import/no-mutable-exports": "error",
|
|
234
|
+
"import/no-named-default": "error",
|
|
235
|
+
"import/no-self-import": "error",
|
|
236
|
+
"import/no-webpack-loader-syntax": "error",
|
|
237
|
+
"import/order": "error",
|
|
238
|
+
...stylistic2 ? {
|
|
239
|
+
"import/newline-after-import": ["error", { considerComments: true, count: 1 }]
|
|
240
|
+
} : {}
|
|
241
|
+
}
|
|
191
242
|
}
|
|
192
|
-
|
|
193
|
-
|
|
243
|
+
];
|
|
244
|
+
}
|
|
194
245
|
|
|
195
246
|
// src/configs/javascript.ts
|
|
196
247
|
var import_globals = __toESM(require("globals"), 1);
|
|
@@ -200,7 +251,17 @@ var OFF = 0;
|
|
|
200
251
|
|
|
201
252
|
// src/configs/javascript.ts
|
|
202
253
|
function javascript(options = {}) {
|
|
254
|
+
const {
|
|
255
|
+
isInEditor = false,
|
|
256
|
+
overrides = {}
|
|
257
|
+
} = options;
|
|
203
258
|
return [
|
|
259
|
+
{
|
|
260
|
+
plugins: {
|
|
261
|
+
"antfu": import_eslint_plugin_antfu.default,
|
|
262
|
+
"unused-imports": import_eslint_plugin_unused_imports.default
|
|
263
|
+
}
|
|
264
|
+
},
|
|
204
265
|
{
|
|
205
266
|
languageOptions: {
|
|
206
267
|
ecmaVersion: 2022,
|
|
@@ -221,14 +282,8 @@ function javascript(options = {}) {
|
|
|
221
282
|
},
|
|
222
283
|
sourceType: "module"
|
|
223
284
|
},
|
|
224
|
-
plugins: {
|
|
225
|
-
"antfu": import_eslint_plugin_antfu.default,
|
|
226
|
-
"unused-imports": import_eslint_plugin_unused_imports.default
|
|
227
|
-
},
|
|
228
285
|
rules: {
|
|
229
286
|
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
230
|
-
"antfu/import-dedupe": "error",
|
|
231
|
-
"antfu/no-import-node-modules-by-path": "error",
|
|
232
287
|
"antfu/top-level-function": "error",
|
|
233
288
|
"array-callback-return": "error",
|
|
234
289
|
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
@@ -403,7 +458,7 @@ function javascript(options = {}) {
|
|
|
403
458
|
],
|
|
404
459
|
"symbol-description": "error",
|
|
405
460
|
"unicode-bom": ["error", "never"],
|
|
406
|
-
"unused-imports/no-unused-imports":
|
|
461
|
+
"unused-imports/no-unused-imports": isInEditor ? OFF : "error",
|
|
407
462
|
"unused-imports/no-unused-vars": [
|
|
408
463
|
"error",
|
|
409
464
|
{ args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^_" }
|
|
@@ -412,7 +467,8 @@ function javascript(options = {}) {
|
|
|
412
467
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
413
468
|
"vars-on-top": "error",
|
|
414
469
|
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
415
|
-
"yoda": ["error", "never"]
|
|
470
|
+
"yoda": ["error", "never"],
|
|
471
|
+
...overrides
|
|
416
472
|
}
|
|
417
473
|
},
|
|
418
474
|
{
|
|
@@ -425,97 +481,119 @@ function javascript(options = {}) {
|
|
|
425
481
|
}
|
|
426
482
|
|
|
427
483
|
// src/configs/jsdoc.ts
|
|
428
|
-
|
|
429
|
-
{
|
|
430
|
-
|
|
431
|
-
|
|
484
|
+
function jsdoc(options = {}) {
|
|
485
|
+
const {
|
|
486
|
+
stylistic: stylistic2 = true
|
|
487
|
+
} = options;
|
|
488
|
+
return [
|
|
489
|
+
{
|
|
490
|
+
plugins: {
|
|
491
|
+
jsdoc: import_eslint_plugin_jsdoc.default
|
|
492
|
+
}
|
|
432
493
|
},
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
494
|
+
{
|
|
495
|
+
rules: {
|
|
496
|
+
"jsdoc/check-access": "warn",
|
|
497
|
+
"jsdoc/check-param-names": "warn",
|
|
498
|
+
"jsdoc/check-property-names": "warn",
|
|
499
|
+
"jsdoc/check-types": "warn",
|
|
500
|
+
"jsdoc/empty-tags": "warn",
|
|
501
|
+
"jsdoc/implements-on-classes": "warn",
|
|
502
|
+
"jsdoc/no-defaults": "warn",
|
|
503
|
+
"jsdoc/no-multi-asterisks": "warn",
|
|
504
|
+
"jsdoc/require-param-name": "warn",
|
|
505
|
+
"jsdoc/require-property": "warn",
|
|
506
|
+
"jsdoc/require-property-description": "warn",
|
|
507
|
+
"jsdoc/require-property-name": "warn",
|
|
508
|
+
"jsdoc/require-returns-check": "warn",
|
|
509
|
+
"jsdoc/require-returns-description": "warn",
|
|
510
|
+
"jsdoc/require-yields-check": "warn",
|
|
511
|
+
"jsdoc/valid-types": "warn",
|
|
512
|
+
...stylistic2 ? {
|
|
513
|
+
"jsdoc/check-alignment": "warn",
|
|
514
|
+
"jsdoc/multiline-blocks": "warn"
|
|
515
|
+
} : {}
|
|
516
|
+
}
|
|
453
517
|
}
|
|
454
|
-
|
|
455
|
-
|
|
518
|
+
];
|
|
519
|
+
}
|
|
456
520
|
|
|
457
521
|
// src/configs/jsonc.ts
|
|
458
|
-
|
|
459
|
-
{
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
522
|
+
function jsonc(options = {}) {
|
|
523
|
+
const {
|
|
524
|
+
stylistic: stylistic2 = true,
|
|
525
|
+
overrides = {}
|
|
526
|
+
} = options;
|
|
527
|
+
return [
|
|
528
|
+
{
|
|
529
|
+
plugins: {
|
|
530
|
+
jsonc: import_eslint_plugin_jsonc.default
|
|
531
|
+
}
|
|
466
532
|
},
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
533
|
+
{
|
|
534
|
+
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
535
|
+
languageOptions: {
|
|
536
|
+
parser: import_jsonc_eslint_parser.default
|
|
537
|
+
},
|
|
538
|
+
rules: {
|
|
539
|
+
"jsonc/no-bigint-literals": "error",
|
|
540
|
+
"jsonc/no-binary-expression": "error",
|
|
541
|
+
"jsonc/no-binary-numeric-literals": "error",
|
|
542
|
+
"jsonc/no-dupe-keys": "error",
|
|
543
|
+
"jsonc/no-escape-sequence-in-identifier": "error",
|
|
544
|
+
"jsonc/no-floating-decimal": "error",
|
|
545
|
+
"jsonc/no-hexadecimal-numeric-literals": "error",
|
|
546
|
+
"jsonc/no-infinity": "error",
|
|
547
|
+
"jsonc/no-multi-str": "error",
|
|
548
|
+
"jsonc/no-nan": "error",
|
|
549
|
+
"jsonc/no-number-props": "error",
|
|
550
|
+
"jsonc/no-numeric-separators": "error",
|
|
551
|
+
"jsonc/no-octal": "error",
|
|
552
|
+
"jsonc/no-octal-escape": "error",
|
|
553
|
+
"jsonc/no-octal-numeric-literals": "error",
|
|
554
|
+
"jsonc/no-parenthesized": "error",
|
|
555
|
+
"jsonc/no-plus-sign": "error",
|
|
556
|
+
"jsonc/no-regexp-literals": "error",
|
|
557
|
+
"jsonc/no-sparse-arrays": "error",
|
|
558
|
+
"jsonc/no-template-literals": "error",
|
|
559
|
+
"jsonc/no-undefined-value": "error",
|
|
560
|
+
"jsonc/no-unicode-codepoint-escapes": "error",
|
|
561
|
+
"jsonc/no-useless-escape": "error",
|
|
562
|
+
"jsonc/space-unary-ops": "error",
|
|
563
|
+
"jsonc/valid-json-number": "error",
|
|
564
|
+
"jsonc/vue-custom-block/no-parsing-error": "error",
|
|
565
|
+
...stylistic2 ? {
|
|
566
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
567
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
568
|
+
"jsonc/comma-style": ["error", "last"],
|
|
569
|
+
"jsonc/indent": ["error", 2],
|
|
570
|
+
"jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
571
|
+
"jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
572
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
573
|
+
"jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
574
|
+
"jsonc/quote-props": "error",
|
|
575
|
+
"jsonc/quotes": "error"
|
|
576
|
+
} : {},
|
|
577
|
+
...overrides
|
|
578
|
+
}
|
|
504
579
|
}
|
|
505
|
-
|
|
506
|
-
|
|
580
|
+
];
|
|
581
|
+
}
|
|
507
582
|
|
|
508
583
|
// src/configs/markdown.ts
|
|
509
584
|
function markdown(options = {}) {
|
|
510
585
|
const {
|
|
511
|
-
componentExts = []
|
|
586
|
+
componentExts = [],
|
|
587
|
+
overrides = {}
|
|
512
588
|
} = options;
|
|
513
589
|
return [
|
|
514
590
|
{
|
|
515
|
-
files: [GLOB_MARKDOWN],
|
|
516
591
|
plugins: {
|
|
517
592
|
markdown: import_eslint_plugin_markdown.default
|
|
518
|
-
}
|
|
593
|
+
}
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
files: [GLOB_MARKDOWN],
|
|
519
597
|
processor: "markdown/markdown"
|
|
520
598
|
},
|
|
521
599
|
{
|
|
@@ -530,9 +608,6 @@ function markdown(options = {}) {
|
|
|
530
608
|
}
|
|
531
609
|
}
|
|
532
610
|
},
|
|
533
|
-
plugins: {
|
|
534
|
-
ts: import_eslint_plugin2.default
|
|
535
|
-
},
|
|
536
611
|
rules: {
|
|
537
612
|
"antfu/no-cjs-exports": OFF,
|
|
538
613
|
"antfu/no-ts-export-equal": OFF,
|
|
@@ -553,340 +628,370 @@ function markdown(options = {}) {
|
|
|
553
628
|
"ts/no-var-requires": OFF,
|
|
554
629
|
"unicode-bom": "off",
|
|
555
630
|
"unused-imports/no-unused-imports": OFF,
|
|
556
|
-
"unused-imports/no-unused-vars": OFF
|
|
631
|
+
"unused-imports/no-unused-vars": OFF,
|
|
632
|
+
// Type aware rules
|
|
633
|
+
...{
|
|
634
|
+
"ts/await-thenable": OFF,
|
|
635
|
+
"ts/dot-notation": OFF,
|
|
636
|
+
"ts/no-floating-promises": OFF,
|
|
637
|
+
"ts/no-for-in-array": OFF,
|
|
638
|
+
"ts/no-implied-eval": OFF,
|
|
639
|
+
"ts/no-misused-promises": OFF,
|
|
640
|
+
"ts/no-throw-literal": OFF,
|
|
641
|
+
"ts/no-unnecessary-type-assertion": OFF,
|
|
642
|
+
"ts/no-unsafe-argument": OFF,
|
|
643
|
+
"ts/no-unsafe-assignment": OFF,
|
|
644
|
+
"ts/no-unsafe-call": OFF,
|
|
645
|
+
"ts/no-unsafe-member-access": OFF,
|
|
646
|
+
"ts/no-unsafe-return": OFF,
|
|
647
|
+
"ts/restrict-plus-operands": OFF,
|
|
648
|
+
"ts/restrict-template-expressions": OFF,
|
|
649
|
+
"ts/unbound-method": OFF
|
|
650
|
+
},
|
|
651
|
+
...overrides
|
|
557
652
|
}
|
|
558
653
|
}
|
|
559
654
|
];
|
|
560
655
|
}
|
|
561
656
|
|
|
562
657
|
// src/configs/node.ts
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
658
|
+
function node() {
|
|
659
|
+
return [
|
|
660
|
+
{
|
|
661
|
+
plugins: {
|
|
662
|
+
node: import_eslint_plugin_n.default
|
|
663
|
+
},
|
|
664
|
+
rules: {
|
|
665
|
+
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
666
|
+
"node/no-deprecated-api": "error",
|
|
667
|
+
"node/no-exports-assign": "error",
|
|
668
|
+
"node/no-new-require": "error",
|
|
669
|
+
"node/no-path-concat": "error",
|
|
670
|
+
"node/prefer-global/buffer": ["error", "never"],
|
|
671
|
+
"node/prefer-global/process": ["error", "never"],
|
|
672
|
+
"node/process-exit-as-throw": "error"
|
|
673
|
+
}
|
|
577
674
|
}
|
|
578
|
-
|
|
579
|
-
|
|
675
|
+
];
|
|
676
|
+
}
|
|
580
677
|
|
|
581
678
|
// src/configs/sort.ts
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
"
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
"
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
679
|
+
function sortPackageJson() {
|
|
680
|
+
return [
|
|
681
|
+
{
|
|
682
|
+
files: ["**/package.json"],
|
|
683
|
+
rules: {
|
|
684
|
+
"jsonc/sort-array-values": [
|
|
685
|
+
"error",
|
|
686
|
+
{
|
|
687
|
+
order: { type: "asc" },
|
|
688
|
+
pathPattern: "^files$"
|
|
689
|
+
}
|
|
690
|
+
],
|
|
691
|
+
"jsonc/sort-keys": [
|
|
692
|
+
"error",
|
|
693
|
+
{
|
|
694
|
+
order: [
|
|
695
|
+
"publisher",
|
|
696
|
+
"name",
|
|
697
|
+
"displayName",
|
|
698
|
+
"type",
|
|
699
|
+
"version",
|
|
700
|
+
"private",
|
|
701
|
+
"packageManager",
|
|
702
|
+
"description",
|
|
703
|
+
"author",
|
|
704
|
+
"license",
|
|
705
|
+
"funding",
|
|
706
|
+
"homepage",
|
|
707
|
+
"repository",
|
|
708
|
+
"bugs",
|
|
709
|
+
"keywords",
|
|
710
|
+
"categories",
|
|
711
|
+
"sideEffects",
|
|
712
|
+
"exports",
|
|
713
|
+
"main",
|
|
714
|
+
"module",
|
|
715
|
+
"unpkg",
|
|
716
|
+
"jsdelivr",
|
|
717
|
+
"types",
|
|
718
|
+
"typesVersions",
|
|
719
|
+
"bin",
|
|
720
|
+
"icon",
|
|
721
|
+
"files",
|
|
722
|
+
"engines",
|
|
723
|
+
"activationEvents",
|
|
724
|
+
"contributes",
|
|
725
|
+
"scripts",
|
|
726
|
+
"peerDependencies",
|
|
727
|
+
"peerDependenciesMeta",
|
|
728
|
+
"dependencies",
|
|
729
|
+
"optionalDependencies",
|
|
730
|
+
"devDependencies",
|
|
731
|
+
"pnpm",
|
|
732
|
+
"overrides",
|
|
733
|
+
"resolutions",
|
|
734
|
+
"husky",
|
|
735
|
+
"simple-git-hooks",
|
|
736
|
+
"lint-staged",
|
|
737
|
+
"nano-staged",
|
|
738
|
+
"eslintConfig"
|
|
739
|
+
],
|
|
740
|
+
pathPattern: "^$"
|
|
741
|
+
},
|
|
742
|
+
{
|
|
743
|
+
order: { type: "asc" },
|
|
744
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
order: { type: "asc" },
|
|
748
|
+
pathPattern: "^resolutions$"
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
order: { type: "asc" },
|
|
752
|
+
pathPattern: "^pnpm.overrides$"
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
order: [
|
|
756
|
+
"types",
|
|
757
|
+
"import",
|
|
758
|
+
"require",
|
|
759
|
+
"default"
|
|
760
|
+
],
|
|
761
|
+
pathPattern: "^exports.*$"
|
|
762
|
+
}
|
|
763
|
+
]
|
|
764
|
+
}
|
|
665
765
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
"
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
766
|
+
];
|
|
767
|
+
}
|
|
768
|
+
function sortTsconfig() {
|
|
769
|
+
return [
|
|
770
|
+
{
|
|
771
|
+
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
772
|
+
rules: {
|
|
773
|
+
"jsonc/sort-keys": [
|
|
774
|
+
"error",
|
|
775
|
+
{
|
|
776
|
+
order: [
|
|
777
|
+
"extends",
|
|
778
|
+
"compilerOptions",
|
|
779
|
+
"references",
|
|
780
|
+
"files",
|
|
781
|
+
"include",
|
|
782
|
+
"exclude"
|
|
783
|
+
],
|
|
784
|
+
pathPattern: "^$"
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
order: [
|
|
788
|
+
/* Projects */
|
|
789
|
+
"incremental",
|
|
790
|
+
"composite",
|
|
791
|
+
"tsBuildInfoFile",
|
|
792
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
793
|
+
"disableSolutionSearching",
|
|
794
|
+
"disableReferencedProjectLoad",
|
|
795
|
+
/* Language and Environment */
|
|
796
|
+
"target",
|
|
797
|
+
"lib",
|
|
798
|
+
"jsx",
|
|
799
|
+
"experimentalDecorators",
|
|
800
|
+
"emitDecoratorMetadata",
|
|
801
|
+
"jsxFactory",
|
|
802
|
+
"jsxFragmentFactory",
|
|
803
|
+
"jsxImportSource",
|
|
804
|
+
"reactNamespace",
|
|
805
|
+
"noLib",
|
|
806
|
+
"useDefineForClassFields",
|
|
807
|
+
"moduleDetection",
|
|
808
|
+
/* Modules */
|
|
809
|
+
"module",
|
|
810
|
+
"rootDir",
|
|
811
|
+
"moduleResolution",
|
|
812
|
+
"baseUrl",
|
|
813
|
+
"paths",
|
|
814
|
+
"rootDirs",
|
|
815
|
+
"typeRoots",
|
|
816
|
+
"types",
|
|
817
|
+
"allowUmdGlobalAccess",
|
|
818
|
+
"moduleSuffixes",
|
|
819
|
+
"allowImportingTsExtensions",
|
|
820
|
+
"resolvePackageJsonExports",
|
|
821
|
+
"resolvePackageJsonImports",
|
|
822
|
+
"customConditions",
|
|
823
|
+
"resolveJsonModule",
|
|
824
|
+
"allowArbitraryExtensions",
|
|
825
|
+
"noResolve",
|
|
826
|
+
/* JavaScript Support */
|
|
827
|
+
"allowJs",
|
|
828
|
+
"checkJs",
|
|
829
|
+
"maxNodeModuleJsDepth",
|
|
830
|
+
/* Emit */
|
|
831
|
+
"declaration",
|
|
832
|
+
"declarationMap",
|
|
833
|
+
"emitDeclarationOnly",
|
|
834
|
+
"sourceMap",
|
|
835
|
+
"inlineSourceMap",
|
|
836
|
+
"outFile",
|
|
837
|
+
"outDir",
|
|
838
|
+
"removeComments",
|
|
839
|
+
"noEmit",
|
|
840
|
+
"importHelpers",
|
|
841
|
+
"importsNotUsedAsValues",
|
|
842
|
+
"downlevelIteration",
|
|
843
|
+
"sourceRoot",
|
|
844
|
+
"mapRoot",
|
|
845
|
+
"inlineSources",
|
|
846
|
+
"emitBOM",
|
|
847
|
+
"newLine",
|
|
848
|
+
"stripInternal",
|
|
849
|
+
"noEmitHelpers",
|
|
850
|
+
"noEmitOnError",
|
|
851
|
+
"preserveConstEnums",
|
|
852
|
+
"declarationDir",
|
|
853
|
+
"preserveValueImports",
|
|
854
|
+
/* Interop Constraints */
|
|
855
|
+
"isolatedModules",
|
|
856
|
+
"verbatimModuleSyntax",
|
|
857
|
+
"allowSyntheticDefaultImports",
|
|
858
|
+
"esModuleInterop",
|
|
859
|
+
"preserveSymlinks",
|
|
860
|
+
"forceConsistentCasingInFileNames",
|
|
861
|
+
/* Type Checking */
|
|
862
|
+
"strict",
|
|
863
|
+
"strictBindCallApply",
|
|
864
|
+
"strictFunctionTypes",
|
|
865
|
+
"strictNullChecks",
|
|
866
|
+
"strictPropertyInitialization",
|
|
867
|
+
"allowUnreachableCode",
|
|
868
|
+
"allowUnusedLabels",
|
|
869
|
+
"alwaysStrict",
|
|
870
|
+
"exactOptionalPropertyTypes",
|
|
871
|
+
"noFallthroughCasesInSwitch",
|
|
872
|
+
"noImplicitAny",
|
|
873
|
+
"noImplicitOverride",
|
|
874
|
+
"noImplicitReturns",
|
|
875
|
+
"noImplicitThis",
|
|
876
|
+
"noPropertyAccessFromIndexSignature",
|
|
877
|
+
"noUncheckedIndexedAccess",
|
|
878
|
+
"noUnusedLocals",
|
|
879
|
+
"noUnusedParameters",
|
|
880
|
+
"useUnknownInCatchVariables",
|
|
881
|
+
/* Completeness */
|
|
882
|
+
"skipDefaultLibCheck",
|
|
883
|
+
"skipLibCheck"
|
|
884
|
+
],
|
|
885
|
+
pathPattern: "^compilerOptions$"
|
|
886
|
+
}
|
|
887
|
+
]
|
|
888
|
+
}
|
|
787
889
|
}
|
|
788
|
-
|
|
789
|
-
|
|
890
|
+
];
|
|
891
|
+
}
|
|
790
892
|
|
|
791
893
|
// src/configs/stylistic.ts
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
894
|
+
function stylistic() {
|
|
895
|
+
return [
|
|
896
|
+
{
|
|
897
|
+
plugins: {
|
|
898
|
+
antfu: import_eslint_plugin_antfu.default,
|
|
899
|
+
style: import_eslint_plugin.default
|
|
900
|
+
},
|
|
901
|
+
rules: {
|
|
902
|
+
"antfu/consistent-list-newline": "error",
|
|
903
|
+
"antfu/if-newline": "error",
|
|
904
|
+
"curly": ["error", "multi-or-nest", "consistent"],
|
|
905
|
+
"style/array-bracket-spacing": ["error", "never"],
|
|
906
|
+
"style/arrow-spacing": ["error", { after: true, before: true }],
|
|
907
|
+
"style/block-spacing": ["error", "always"],
|
|
908
|
+
"style/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
909
|
+
"style/comma-dangle": ["error", "always-multiline"],
|
|
910
|
+
"style/comma-spacing": ["error", { after: true, before: false }],
|
|
911
|
+
"style/comma-style": ["error", "last"],
|
|
912
|
+
"style/computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
|
|
913
|
+
"style/dot-location": ["error", "property"],
|
|
914
|
+
"style/indent": ["error", 2, {
|
|
915
|
+
ArrayExpression: 1,
|
|
916
|
+
CallExpression: { arguments: 1 },
|
|
917
|
+
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
918
|
+
FunctionExpression: { body: 1, parameters: 1 },
|
|
919
|
+
ImportDeclaration: 1,
|
|
920
|
+
MemberExpression: 1,
|
|
921
|
+
ObjectExpression: 1,
|
|
922
|
+
SwitchCase: 1,
|
|
923
|
+
VariableDeclarator: 1,
|
|
924
|
+
flatTernaryExpressions: false,
|
|
925
|
+
ignoreComments: false,
|
|
926
|
+
ignoredNodes: [
|
|
927
|
+
"TemplateLiteral *",
|
|
928
|
+
"JSXElement",
|
|
929
|
+
"JSXElement > *",
|
|
930
|
+
"JSXAttribute",
|
|
931
|
+
"JSXIdentifier",
|
|
932
|
+
"JSXNamespacedName",
|
|
933
|
+
"JSXMemberExpression",
|
|
934
|
+
"JSXSpreadAttribute",
|
|
935
|
+
"JSXExpressionContainer",
|
|
936
|
+
"JSXOpeningElement",
|
|
937
|
+
"JSXClosingElement",
|
|
938
|
+
"JSXFragment",
|
|
939
|
+
"JSXOpeningFragment",
|
|
940
|
+
"JSXClosingFragment",
|
|
941
|
+
"JSXText",
|
|
942
|
+
"JSXEmptyExpression",
|
|
943
|
+
"JSXSpreadChild",
|
|
944
|
+
"TSTypeParameterInstantiation",
|
|
945
|
+
"FunctionExpression > .params[decorators.length > 0]",
|
|
946
|
+
"FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
|
|
947
|
+
"ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
|
|
948
|
+
],
|
|
949
|
+
offsetTernaryExpressions: true,
|
|
950
|
+
outerIIFEBody: 1
|
|
951
|
+
}],
|
|
952
|
+
"style/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
953
|
+
"style/keyword-spacing": ["error", { after: true, before: true }],
|
|
954
|
+
"style/lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
|
|
955
|
+
"style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
956
|
+
"style/multiline-ternary": ["error", "always-multiline"],
|
|
957
|
+
"style/no-mixed-spaces-and-tabs": "error",
|
|
958
|
+
"style/no-multi-spaces": "error",
|
|
959
|
+
"style/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
960
|
+
"style/no-tabs": "error",
|
|
961
|
+
"style/no-trailing-spaces": "error",
|
|
962
|
+
"style/no-whitespace-before-property": "error",
|
|
963
|
+
"style/object-curly-spacing": ["error", "always"],
|
|
964
|
+
"style/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
965
|
+
"style/operator-linebreak": ["error", "before"],
|
|
966
|
+
"style/padded-blocks": ["error", { blocks: "never", classes: "never", switches: "never" }],
|
|
967
|
+
"style/quotes": ["error", "single"],
|
|
968
|
+
"style/rest-spread-spacing": ["error", "never"],
|
|
969
|
+
"style/semi": ["error", "never"],
|
|
970
|
+
"style/semi-spacing": ["error", { after: true, before: false }],
|
|
971
|
+
"style/space-before-blocks": ["error", "always"],
|
|
972
|
+
"style/space-before-function-paren": ["error", { anonymous: "always", asyncArrow: "always", named: "never" }],
|
|
973
|
+
"style/space-in-parens": ["error", "never"],
|
|
974
|
+
"style/space-infix-ops": "error",
|
|
975
|
+
"style/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
976
|
+
"style/spaced-comment": ["error", "always", {
|
|
977
|
+
block: {
|
|
978
|
+
balanced: true,
|
|
979
|
+
exceptions: ["*"],
|
|
980
|
+
markers: ["!"]
|
|
981
|
+
},
|
|
982
|
+
line: {
|
|
983
|
+
exceptions: ["/", "#"],
|
|
984
|
+
markers: ["/"]
|
|
985
|
+
}
|
|
986
|
+
}],
|
|
987
|
+
"style/template-curly-spacing": "error",
|
|
988
|
+
"style/template-tag-spacing": ["error", "never"],
|
|
989
|
+
"style/type-annotation-spacing": ["error", {}],
|
|
990
|
+
"style/yield-star-spacing": ["error", "both"]
|
|
991
|
+
}
|
|
887
992
|
}
|
|
888
|
-
|
|
889
|
-
|
|
993
|
+
];
|
|
994
|
+
}
|
|
890
995
|
|
|
891
996
|
// src/configs/typescript.ts
|
|
892
997
|
var import_node_process = __toESM(require("process"), 1);
|
|
@@ -908,9 +1013,40 @@ function renameRules(rules, from, to) {
|
|
|
908
1013
|
// src/configs/typescript.ts
|
|
909
1014
|
function typescript(options) {
|
|
910
1015
|
const {
|
|
911
|
-
componentExts = []
|
|
1016
|
+
componentExts = [],
|
|
1017
|
+
overrides = {},
|
|
1018
|
+
parserOptions = {},
|
|
1019
|
+
tsconfigPath
|
|
912
1020
|
} = options ?? {};
|
|
1021
|
+
const typeAwareRules = {
|
|
1022
|
+
"dot-notation": OFF,
|
|
1023
|
+
"no-implied-eval": OFF,
|
|
1024
|
+
"no-throw-literal": OFF,
|
|
1025
|
+
"ts/await-thenable": "error",
|
|
1026
|
+
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
1027
|
+
"ts/no-floating-promises": "error",
|
|
1028
|
+
"ts/no-for-in-array": "error",
|
|
1029
|
+
"ts/no-implied-eval": "error",
|
|
1030
|
+
"ts/no-misused-promises": "error",
|
|
1031
|
+
"ts/no-throw-literal": "error",
|
|
1032
|
+
"ts/no-unnecessary-type-assertion": "error",
|
|
1033
|
+
"ts/no-unsafe-argument": "error",
|
|
1034
|
+
"ts/no-unsafe-assignment": "error",
|
|
1035
|
+
"ts/no-unsafe-call": "error",
|
|
1036
|
+
"ts/no-unsafe-member-access": "error",
|
|
1037
|
+
"ts/no-unsafe-return": "error",
|
|
1038
|
+
"ts/restrict-plus-operands": "error",
|
|
1039
|
+
"ts/restrict-template-expressions": "error",
|
|
1040
|
+
"ts/unbound-method": "error"
|
|
1041
|
+
};
|
|
913
1042
|
return [
|
|
1043
|
+
{
|
|
1044
|
+
plugins: {
|
|
1045
|
+
antfu: import_eslint_plugin_antfu.default,
|
|
1046
|
+
import: import_eslint_plugin_i.default,
|
|
1047
|
+
ts: import_eslint_plugin2.default
|
|
1048
|
+
}
|
|
1049
|
+
},
|
|
914
1050
|
{
|
|
915
1051
|
files: [
|
|
916
1052
|
GLOB_TS,
|
|
@@ -920,14 +1056,14 @@ function typescript(options) {
|
|
|
920
1056
|
languageOptions: {
|
|
921
1057
|
parser: import_parser.default,
|
|
922
1058
|
parserOptions: {
|
|
923
|
-
sourceType: "module"
|
|
1059
|
+
sourceType: "module",
|
|
1060
|
+
...tsconfigPath ? {
|
|
1061
|
+
project: [tsconfigPath],
|
|
1062
|
+
tsconfigRootDir: import_node_process.default.cwd()
|
|
1063
|
+
} : {},
|
|
1064
|
+
...parserOptions
|
|
924
1065
|
}
|
|
925
1066
|
},
|
|
926
|
-
plugins: {
|
|
927
|
-
antfu: import_eslint_plugin_antfu.default,
|
|
928
|
-
import: import_eslint_plugin_i.default,
|
|
929
|
-
ts: import_eslint_plugin2.default
|
|
930
|
-
},
|
|
931
1067
|
rules: {
|
|
932
1068
|
...renameRules(
|
|
933
1069
|
import_eslint_plugin2.default.configs["eslint-recommended"].overrides[0].rules,
|
|
@@ -968,7 +1104,9 @@ function typescript(options) {
|
|
|
968
1104
|
"ts/no-unused-vars": OFF,
|
|
969
1105
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
970
1106
|
"ts/prefer-ts-expect-error": "error",
|
|
971
|
-
"ts/triple-slash-reference": OFF
|
|
1107
|
+
"ts/triple-slash-reference": OFF,
|
|
1108
|
+
...tsconfigPath ? typeAwareRules : {},
|
|
1109
|
+
...overrides
|
|
972
1110
|
}
|
|
973
1111
|
},
|
|
974
1112
|
{
|
|
@@ -994,94 +1132,50 @@ function typescript(options) {
|
|
|
994
1132
|
}
|
|
995
1133
|
];
|
|
996
1134
|
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
tsconfigPath,
|
|
1001
|
-
tsconfigRootDir = import_node_process.default.cwd()
|
|
1002
|
-
} = options;
|
|
1135
|
+
|
|
1136
|
+
// src/configs/unicorn.ts
|
|
1137
|
+
function unicorn() {
|
|
1003
1138
|
return [
|
|
1004
1139
|
{
|
|
1005
|
-
files: [
|
|
1006
|
-
GLOB_TS,
|
|
1007
|
-
GLOB_TSX,
|
|
1008
|
-
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1009
|
-
],
|
|
1010
|
-
ignores: ["**/*.md/*.*"],
|
|
1011
|
-
languageOptions: {
|
|
1012
|
-
parser: import_parser.default,
|
|
1013
|
-
parserOptions: {
|
|
1014
|
-
project: [tsconfigPath],
|
|
1015
|
-
tsconfigRootDir
|
|
1016
|
-
}
|
|
1017
|
-
},
|
|
1018
1140
|
plugins: {
|
|
1019
|
-
|
|
1020
|
-
}
|
|
1141
|
+
unicorn: import_eslint_plugin_unicorn.default
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1144
|
+
{
|
|
1021
1145
|
rules: {
|
|
1022
|
-
|
|
1023
|
-
"
|
|
1024
|
-
|
|
1025
|
-
"
|
|
1026
|
-
|
|
1027
|
-
"
|
|
1028
|
-
|
|
1029
|
-
"
|
|
1030
|
-
|
|
1031
|
-
"
|
|
1032
|
-
|
|
1033
|
-
"
|
|
1034
|
-
|
|
1035
|
-
"
|
|
1036
|
-
|
|
1037
|
-
"
|
|
1038
|
-
|
|
1039
|
-
"
|
|
1040
|
-
|
|
1146
|
+
// Pass error message when throwing errors
|
|
1147
|
+
"unicorn/error-message": "error",
|
|
1148
|
+
// Uppercase regex escapes
|
|
1149
|
+
"unicorn/escape-case": "error",
|
|
1150
|
+
// Array.isArray instead of instanceof
|
|
1151
|
+
"unicorn/no-instanceof-array": "error",
|
|
1152
|
+
// Ban `new Array` as `Array` constructor's params are ambiguous
|
|
1153
|
+
"unicorn/no-new-array": "error",
|
|
1154
|
+
// Prevent deprecated `new Buffer()`
|
|
1155
|
+
"unicorn/no-new-buffer": "error",
|
|
1156
|
+
// Keep regex literals safe!
|
|
1157
|
+
"unicorn/no-unsafe-regex": "error",
|
|
1158
|
+
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
1159
|
+
"unicorn/number-literal-case": "error",
|
|
1160
|
+
// includes over indexOf when checking for existence
|
|
1161
|
+
"unicorn/prefer-includes": "error",
|
|
1162
|
+
// Prefer using the node: protocol
|
|
1163
|
+
"unicorn/prefer-node-protocol": "error",
|
|
1164
|
+
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
1165
|
+
"unicorn/prefer-number-properties": "error",
|
|
1166
|
+
// String methods startsWith/endsWith instead of more complicated stuff
|
|
1167
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1168
|
+
// textContent instead of innerText
|
|
1169
|
+
"unicorn/prefer-text-content": "error",
|
|
1170
|
+
// Enforce throwing type error when throwing error while checking typeof
|
|
1171
|
+
"unicorn/prefer-type-error": "error",
|
|
1172
|
+
// Use new when throwing error
|
|
1173
|
+
"unicorn/throw-new-error": "error"
|
|
1041
1174
|
}
|
|
1042
1175
|
}
|
|
1043
1176
|
];
|
|
1044
1177
|
}
|
|
1045
1178
|
|
|
1046
|
-
// src/configs/unicorn.ts
|
|
1047
|
-
var unicorn = [
|
|
1048
|
-
{
|
|
1049
|
-
plugins: {
|
|
1050
|
-
unicorn: import_eslint_plugin_unicorn.default
|
|
1051
|
-
},
|
|
1052
|
-
rules: {
|
|
1053
|
-
// Pass error message when throwing errors
|
|
1054
|
-
"unicorn/error-message": "error",
|
|
1055
|
-
// Uppercase regex escapes
|
|
1056
|
-
"unicorn/escape-case": "error",
|
|
1057
|
-
// Array.isArray instead of instanceof
|
|
1058
|
-
"unicorn/no-instanceof-array": "error",
|
|
1059
|
-
// Ban `new Array` as `Array` constructor's params are ambiguous
|
|
1060
|
-
"unicorn/no-new-array": "error",
|
|
1061
|
-
// Prevent deprecated `new Buffer()`
|
|
1062
|
-
"unicorn/no-new-buffer": "error",
|
|
1063
|
-
// Keep regex literals safe!
|
|
1064
|
-
"unicorn/no-unsafe-regex": "error",
|
|
1065
|
-
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
1066
|
-
"unicorn/number-literal-case": "error",
|
|
1067
|
-
// includes over indexOf when checking for existence
|
|
1068
|
-
"unicorn/prefer-includes": "error",
|
|
1069
|
-
// Prefer using the node: protocol
|
|
1070
|
-
"unicorn/prefer-node-protocol": "error",
|
|
1071
|
-
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
1072
|
-
"unicorn/prefer-number-properties": "error",
|
|
1073
|
-
// String methods startsWith/endsWith instead of more complicated stuff
|
|
1074
|
-
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1075
|
-
// textContent instead of innerText
|
|
1076
|
-
"unicorn/prefer-text-content": "error",
|
|
1077
|
-
// Enforce throwing type error when throwing error while checking typeof
|
|
1078
|
-
"unicorn/prefer-type-error": "error",
|
|
1079
|
-
// Use new when throwing error
|
|
1080
|
-
"unicorn/throw-new-error": "error"
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
];
|
|
1084
|
-
|
|
1085
1179
|
// src/configs/vue.ts
|
|
1086
1180
|
var import_node_process2 = __toESM(require("process"), 1);
|
|
1087
1181
|
var import_local_pkg = require("local-pkg");
|
|
@@ -1105,7 +1199,16 @@ var vue2Rules = {
|
|
|
1105
1199
|
...import_eslint_plugin_vue.default.configs.recommended.rules
|
|
1106
1200
|
};
|
|
1107
1201
|
function vue(options = {}) {
|
|
1202
|
+
const {
|
|
1203
|
+
overrides = {},
|
|
1204
|
+
stylistic: stylistic2 = true
|
|
1205
|
+
} = options;
|
|
1108
1206
|
return [
|
|
1207
|
+
{
|
|
1208
|
+
plugins: {
|
|
1209
|
+
vue: import_eslint_plugin_vue.default
|
|
1210
|
+
}
|
|
1211
|
+
},
|
|
1109
1212
|
{
|
|
1110
1213
|
files: [GLOB_VUE],
|
|
1111
1214
|
languageOptions: {
|
|
@@ -1119,27 +1222,13 @@ function vue(options = {}) {
|
|
|
1119
1222
|
sourceType: "module"
|
|
1120
1223
|
}
|
|
1121
1224
|
},
|
|
1122
|
-
plugins: {
|
|
1123
|
-
vue: import_eslint_plugin_vue.default
|
|
1124
|
-
},
|
|
1125
1225
|
processor: import_eslint_plugin_vue.default.processors[".vue"],
|
|
1126
1226
|
rules: {
|
|
1127
1227
|
...isVue3 ? vue3Rules : vue2Rules,
|
|
1128
1228
|
"node/prefer-global/process": OFF,
|
|
1129
|
-
"vue/array-bracket-spacing": ["error", "never"],
|
|
1130
|
-
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1131
1229
|
"vue/block-order": ["error", {
|
|
1132
1230
|
order: ["script", "template", "style"]
|
|
1133
1231
|
}],
|
|
1134
|
-
"vue/block-spacing": ["error", "always"],
|
|
1135
|
-
"vue/block-tag-newline": ["error", {
|
|
1136
|
-
multiline: "always",
|
|
1137
|
-
singleline: "always"
|
|
1138
|
-
}],
|
|
1139
|
-
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1140
|
-
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1141
|
-
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1142
|
-
"vue/comma-style": ["error", "last"],
|
|
1143
1232
|
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1144
1233
|
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1145
1234
|
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
@@ -1149,11 +1238,6 @@ function vue(options = {}) {
|
|
|
1149
1238
|
"vue/dot-location": ["error", "property"],
|
|
1150
1239
|
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1151
1240
|
"vue/eqeqeq": ["error", "smart"],
|
|
1152
|
-
"vue/html-comment-content-spacing": ["error", "always", {
|
|
1153
|
-
exceptions: ["-"]
|
|
1154
|
-
}],
|
|
1155
|
-
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1156
|
-
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1157
1241
|
"vue/max-attributes-per-line": OFF,
|
|
1158
1242
|
"vue/multi-word-component-names": OFF,
|
|
1159
1243
|
"vue/no-dupe-keys": OFF,
|
|
@@ -1173,10 +1257,6 @@ function vue(options = {}) {
|
|
|
1173
1257
|
"vue/no-unused-refs": "error",
|
|
1174
1258
|
"vue/no-useless-v-bind": "error",
|
|
1175
1259
|
"vue/no-v-html": OFF,
|
|
1176
|
-
"vue/no-v-text-v-html-on-component": OFF,
|
|
1177
|
-
"vue/object-curly-newline": OFF,
|
|
1178
|
-
"vue/object-curly-spacing": ["error", "always"],
|
|
1179
|
-
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1180
1260
|
"vue/object-shorthand": [
|
|
1181
1261
|
"error",
|
|
1182
1262
|
"always",
|
|
@@ -1185,74 +1265,120 @@ function vue(options = {}) {
|
|
|
1185
1265
|
ignoreConstructors: false
|
|
1186
1266
|
}
|
|
1187
1267
|
],
|
|
1188
|
-
"vue/operator-linebreak": ["error", "before"],
|
|
1189
|
-
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1190
1268
|
"vue/prefer-separate-static-class": "error",
|
|
1191
1269
|
"vue/prefer-template": "error",
|
|
1192
|
-
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1193
1270
|
"vue/require-default-prop": OFF,
|
|
1194
1271
|
"vue/require-prop-types": OFF,
|
|
1195
|
-
"vue/space-in-parens": ["error", "never"],
|
|
1196
1272
|
"vue/space-infix-ops": "error",
|
|
1197
1273
|
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
1198
|
-
|
|
1274
|
+
...stylistic2 ? {
|
|
1275
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
1276
|
+
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1277
|
+
"vue/block-spacing": ["error", "always"],
|
|
1278
|
+
"vue/block-tag-newline": ["error", {
|
|
1279
|
+
multiline: "always",
|
|
1280
|
+
singleline: "always"
|
|
1281
|
+
}],
|
|
1282
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1283
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1284
|
+
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1285
|
+
"vue/comma-style": ["error", "last"],
|
|
1286
|
+
"vue/html-comment-content-spacing": ["error", "always", {
|
|
1287
|
+
exceptions: ["-"]
|
|
1288
|
+
}],
|
|
1289
|
+
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1290
|
+
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1291
|
+
"vue/object-curly-newline": OFF,
|
|
1292
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
1293
|
+
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1294
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
1295
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1296
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1297
|
+
"vue/space-in-parens": ["error", "never"],
|
|
1298
|
+
"vue/template-curly-spacing": "error"
|
|
1299
|
+
} : {},
|
|
1300
|
+
...overrides
|
|
1199
1301
|
}
|
|
1200
1302
|
}
|
|
1201
1303
|
];
|
|
1202
1304
|
}
|
|
1203
1305
|
|
|
1204
|
-
// src/configs/
|
|
1205
|
-
|
|
1206
|
-
{
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
},
|
|
1211
|
-
plugins: {
|
|
1212
|
-
yml: import_eslint_plugin_yml.default
|
|
1213
|
-
},
|
|
1214
|
-
rules: {
|
|
1215
|
-
"style/spaced-comment": OFF,
|
|
1216
|
-
"yml/block-mapping": "error",
|
|
1217
|
-
"yml/block-mapping-question-indicator-newline": "error",
|
|
1218
|
-
"yml/block-sequence": "error",
|
|
1219
|
-
"yml/block-sequence-hyphen-indicator-newline": "error",
|
|
1220
|
-
"yml/flow-mapping-curly-newline": "error",
|
|
1221
|
-
"yml/flow-mapping-curly-spacing": "error",
|
|
1222
|
-
"yml/flow-sequence-bracket-newline": "error",
|
|
1223
|
-
"yml/flow-sequence-bracket-spacing": "error",
|
|
1224
|
-
"yml/indent": ["error", 2],
|
|
1225
|
-
"yml/key-spacing": "error",
|
|
1226
|
-
"yml/no-empty-key": "error",
|
|
1227
|
-
"yml/no-empty-sequence-entry": "error",
|
|
1228
|
-
"yml/no-irregular-whitespace": "error",
|
|
1229
|
-
"yml/no-tab-indent": "error",
|
|
1230
|
-
"yml/plain-scalar": "error",
|
|
1231
|
-
"yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
|
|
1232
|
-
"yml/spaced-comment": "error",
|
|
1233
|
-
"yml/vue-custom-block/no-parsing-error": "error"
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
];
|
|
1237
|
-
|
|
1238
|
-
// src/configs/test.ts
|
|
1239
|
-
function test(options = {}) {
|
|
1306
|
+
// src/configs/yaml.ts
|
|
1307
|
+
function yaml(options = {}) {
|
|
1308
|
+
const {
|
|
1309
|
+
overrides = {},
|
|
1310
|
+
stylistic: stylistic2 = true
|
|
1311
|
+
} = options;
|
|
1240
1312
|
return [
|
|
1241
1313
|
{
|
|
1242
|
-
files: GLOB_TESTS,
|
|
1243
1314
|
plugins: {
|
|
1244
|
-
|
|
1315
|
+
yaml: import_eslint_plugin_yml.default
|
|
1316
|
+
}
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
files: [GLOB_YAML],
|
|
1320
|
+
languageOptions: {
|
|
1321
|
+
parser: import_yaml_eslint_parser.default
|
|
1245
1322
|
},
|
|
1246
1323
|
rules: {
|
|
1247
|
-
"
|
|
1324
|
+
"style/spaced-comment": OFF,
|
|
1325
|
+
"yaml/block-mapping": "error",
|
|
1326
|
+
"yaml/block-sequence": "error",
|
|
1327
|
+
"yaml/no-empty-key": "error",
|
|
1328
|
+
"yaml/no-empty-sequence-entry": "error",
|
|
1329
|
+
"yaml/no-irregular-whitespace": "error",
|
|
1330
|
+
"yaml/plain-scalar": "error",
|
|
1331
|
+
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
1332
|
+
...stylistic2 ? {
|
|
1333
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
1334
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
1335
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
1336
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
1337
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
1338
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
1339
|
+
"yaml/indent": ["error", 2],
|
|
1340
|
+
"yaml/key-spacing": "error",
|
|
1341
|
+
"yaml/no-tab-indent": "error",
|
|
1342
|
+
"yaml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
|
|
1343
|
+
"yaml/spaced-comment": "error"
|
|
1344
|
+
} : {},
|
|
1345
|
+
...overrides
|
|
1248
1346
|
}
|
|
1249
1347
|
}
|
|
1250
1348
|
];
|
|
1251
1349
|
}
|
|
1252
1350
|
|
|
1351
|
+
// src/configs/test.ts
|
|
1352
|
+
function test(options = {}) {
|
|
1353
|
+
const {
|
|
1354
|
+
isInEditor = false,
|
|
1355
|
+
overrides = {}
|
|
1356
|
+
} = options;
|
|
1357
|
+
return [{
|
|
1358
|
+
plugins: {
|
|
1359
|
+
"no-only-tests": import_eslint_plugin_no_only_tests.default
|
|
1360
|
+
}
|
|
1361
|
+
}, {
|
|
1362
|
+
files: GLOB_TESTS,
|
|
1363
|
+
rules: {
|
|
1364
|
+
"no-only-tests/no-only-tests": isInEditor ? OFF : "error",
|
|
1365
|
+
...overrides
|
|
1366
|
+
}
|
|
1367
|
+
}];
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1253
1370
|
// src/configs/react.ts
|
|
1254
1371
|
function react(options = {}) {
|
|
1372
|
+
const {
|
|
1373
|
+
overrides = {}
|
|
1374
|
+
} = options;
|
|
1255
1375
|
return [
|
|
1376
|
+
{
|
|
1377
|
+
plugins: {
|
|
1378
|
+
"react": import_eslint_plugin_react.default,
|
|
1379
|
+
"react-hooks": import_eslint_plugin_react_hooks.default
|
|
1380
|
+
}
|
|
1381
|
+
},
|
|
1256
1382
|
{
|
|
1257
1383
|
files: [GLOB_JSX, GLOB_TSX],
|
|
1258
1384
|
languageOptions: {
|
|
@@ -1264,15 +1390,12 @@ function react(options = {}) {
|
|
|
1264
1390
|
sourceType: "module"
|
|
1265
1391
|
}
|
|
1266
1392
|
},
|
|
1267
|
-
plugins: {
|
|
1268
|
-
"react": import_eslint_plugin_react.default,
|
|
1269
|
-
"react-hooks": import_eslint_plugin_react_hooks.default
|
|
1270
|
-
},
|
|
1271
1393
|
rules: {
|
|
1272
1394
|
"jsx-quotes": ["error", "prefer-double"],
|
|
1273
1395
|
...import_eslint_plugin_react.default.configs.recommended.rules,
|
|
1274
1396
|
"react/react-in-jsx-scope": OFF,
|
|
1275
|
-
...import_eslint_plugin_react_hooks.default.configs.recommended.rules
|
|
1397
|
+
...import_eslint_plugin_react_hooks.default.configs.recommended.rules,
|
|
1398
|
+
...overrides
|
|
1276
1399
|
},
|
|
1277
1400
|
settings: {
|
|
1278
1401
|
react: {
|
|
@@ -1285,7 +1408,13 @@ function react(options = {}) {
|
|
|
1285
1408
|
|
|
1286
1409
|
// src/configs/astro.ts
|
|
1287
1410
|
function astro(options = {}) {
|
|
1411
|
+
const { overrides = {} } = options;
|
|
1288
1412
|
return [
|
|
1413
|
+
{
|
|
1414
|
+
plugins: {
|
|
1415
|
+
astro: import_eslint_plugin_astro.default
|
|
1416
|
+
}
|
|
1417
|
+
},
|
|
1289
1418
|
{
|
|
1290
1419
|
files: [GLOB_ASTRO],
|
|
1291
1420
|
languageOptions: {
|
|
@@ -1295,11 +1424,9 @@ function astro(options = {}) {
|
|
|
1295
1424
|
parser: options.typescript ? import_parser.default : null
|
|
1296
1425
|
}
|
|
1297
1426
|
},
|
|
1298
|
-
plugins: {
|
|
1299
|
-
astro: import_eslint_plugin_astro.default
|
|
1300
|
-
},
|
|
1301
1427
|
rules: {
|
|
1302
|
-
...import_eslint_plugin_astro.default.configs.recommended.rules
|
|
1428
|
+
...import_eslint_plugin_astro.default.configs.recommended.rules,
|
|
1429
|
+
...overrides
|
|
1303
1430
|
}
|
|
1304
1431
|
}
|
|
1305
1432
|
];
|
|
@@ -1316,14 +1443,31 @@ var flatConfigProps = [
|
|
|
1316
1443
|
"rules",
|
|
1317
1444
|
"settings"
|
|
1318
1445
|
];
|
|
1446
|
+
var VuePackages = [
|
|
1447
|
+
"vue",
|
|
1448
|
+
"nuxt",
|
|
1449
|
+
"vitepress",
|
|
1450
|
+
"@slidev/cli"
|
|
1451
|
+
];
|
|
1452
|
+
var ReactPackages = [
|
|
1453
|
+
"react",
|
|
1454
|
+
"next"
|
|
1455
|
+
];
|
|
1456
|
+
var AstroPackages = [
|
|
1457
|
+
"astro"
|
|
1458
|
+
];
|
|
1319
1459
|
function coderwyd(options = {}, ...userConfigs) {
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1460
|
+
const {
|
|
1461
|
+
isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE) && !import_node_process3.default.env.CI),
|
|
1462
|
+
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg2.isPackageExists)(i)),
|
|
1463
|
+
react: enableReact = ReactPackages.some((i) => (0, import_local_pkg2.isPackageExists)(i)),
|
|
1464
|
+
astro: enableAstro = AstroPackages.some((i) => (0, import_local_pkg2.isPackageExists)(i)),
|
|
1465
|
+
typescript: enableTypeScript = (0, import_local_pkg2.isPackageExists)("typescript"),
|
|
1466
|
+
stylistic: enableStylistic = true,
|
|
1467
|
+
gitignore: enableGitignore = true,
|
|
1468
|
+
overrides = {},
|
|
1469
|
+
componentExts = []
|
|
1470
|
+
} = options;
|
|
1327
1471
|
const configs = [];
|
|
1328
1472
|
if (enableGitignore) {
|
|
1329
1473
|
if (typeof enableGitignore !== "boolean") {
|
|
@@ -1334,47 +1478,65 @@ function coderwyd(options = {}, ...userConfigs) {
|
|
|
1334
1478
|
}
|
|
1335
1479
|
}
|
|
1336
1480
|
configs.push(
|
|
1337
|
-
ignores,
|
|
1481
|
+
ignores(),
|
|
1338
1482
|
javascript({ isInEditor }),
|
|
1339
|
-
comments,
|
|
1340
|
-
node,
|
|
1341
|
-
jsdoc
|
|
1342
|
-
|
|
1343
|
-
|
|
1483
|
+
comments(),
|
|
1484
|
+
node(),
|
|
1485
|
+
jsdoc({
|
|
1486
|
+
stylistic: enableStylistic
|
|
1487
|
+
}),
|
|
1488
|
+
imports({
|
|
1489
|
+
stylistic: enableStylistic
|
|
1490
|
+
}),
|
|
1491
|
+
unicorn()
|
|
1344
1492
|
);
|
|
1345
|
-
const componentExts = [];
|
|
1346
1493
|
if (enableVue)
|
|
1347
1494
|
componentExts.push("vue");
|
|
1348
1495
|
if (enableTypeScript) {
|
|
1349
|
-
configs.push(typescript({
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
}));
|
|
1355
|
-
}
|
|
1496
|
+
configs.push(typescript({
|
|
1497
|
+
...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
|
|
1498
|
+
componentExts,
|
|
1499
|
+
overrides: overrides.typescript
|
|
1500
|
+
}));
|
|
1356
1501
|
}
|
|
1357
1502
|
if (enableStylistic)
|
|
1358
|
-
configs.push(stylistic);
|
|
1503
|
+
configs.push(stylistic());
|
|
1359
1504
|
if (options.test ?? true)
|
|
1360
|
-
configs.push(test({ isInEditor }));
|
|
1361
|
-
if (enableVue)
|
|
1362
|
-
configs.push(vue({
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1505
|
+
configs.push(test({ isInEditor, overrides: overrides.test }));
|
|
1506
|
+
if (enableVue) {
|
|
1507
|
+
configs.push(vue({
|
|
1508
|
+
overrides: overrides.vue,
|
|
1509
|
+
stylistic: enableStylistic,
|
|
1510
|
+
typescript: !!enableTypeScript
|
|
1511
|
+
}));
|
|
1512
|
+
}
|
|
1513
|
+
if (enableReact) {
|
|
1514
|
+
configs.push(react({
|
|
1515
|
+
overrides: overrides.react,
|
|
1516
|
+
typescript: !!enableTypeScript
|
|
1517
|
+
}));
|
|
1518
|
+
}
|
|
1519
|
+
if (enableAstro) {
|
|
1520
|
+
configs.push(astro({
|
|
1521
|
+
overrides: overrides.astro,
|
|
1522
|
+
typescript: !!enableTypeScript
|
|
1523
|
+
}));
|
|
1524
|
+
}
|
|
1367
1525
|
if (options.jsonc ?? true) {
|
|
1368
1526
|
configs.push(
|
|
1369
|
-
jsonc,
|
|
1370
|
-
sortPackageJson,
|
|
1371
|
-
sortTsconfig
|
|
1527
|
+
jsonc(),
|
|
1528
|
+
sortPackageJson(),
|
|
1529
|
+
sortTsconfig()
|
|
1372
1530
|
);
|
|
1373
1531
|
}
|
|
1374
|
-
if (options.yaml ?? true)
|
|
1375
|
-
configs.push(
|
|
1532
|
+
if (options.yaml ?? true) {
|
|
1533
|
+
configs.push(yaml({
|
|
1534
|
+
overrides: overrides.yaml,
|
|
1535
|
+
stylistic: enableStylistic
|
|
1536
|
+
}));
|
|
1537
|
+
}
|
|
1376
1538
|
if (options.markdown ?? true)
|
|
1377
|
-
configs.push(markdown({ componentExts }));
|
|
1539
|
+
configs.push(markdown({ componentExts, overrides: overrides.markdown }));
|
|
1378
1540
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
1379
1541
|
if (key in options)
|
|
1380
1542
|
acc[key] = options[key];
|
|
@@ -1393,6 +1555,28 @@ function coderwyd(options = {}, ...userConfigs) {
|
|
|
1393
1555
|
var src_default = coderwyd;
|
|
1394
1556
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1395
1557
|
0 && (module.exports = {
|
|
1558
|
+
GLOB_ALL_SRC,
|
|
1559
|
+
GLOB_ASTRO,
|
|
1560
|
+
GLOB_CSS,
|
|
1561
|
+
GLOB_EXCLUDE,
|
|
1562
|
+
GLOB_HTML,
|
|
1563
|
+
GLOB_JS,
|
|
1564
|
+
GLOB_JSON,
|
|
1565
|
+
GLOB_JSON5,
|
|
1566
|
+
GLOB_JSONC,
|
|
1567
|
+
GLOB_JSX,
|
|
1568
|
+
GLOB_LESS,
|
|
1569
|
+
GLOB_MARKDOWN,
|
|
1570
|
+
GLOB_MARKDOWN_CODE,
|
|
1571
|
+
GLOB_SCSS,
|
|
1572
|
+
GLOB_SRC,
|
|
1573
|
+
GLOB_SRC_EXT,
|
|
1574
|
+
GLOB_STYLE,
|
|
1575
|
+
GLOB_TESTS,
|
|
1576
|
+
GLOB_TS,
|
|
1577
|
+
GLOB_TSX,
|
|
1578
|
+
GLOB_VUE,
|
|
1579
|
+
GLOB_YAML,
|
|
1396
1580
|
astro,
|
|
1397
1581
|
coderwyd,
|
|
1398
1582
|
combine,
|
|
@@ -1409,7 +1593,7 @@ var src_default = coderwyd;
|
|
|
1409
1593
|
parserJsonc,
|
|
1410
1594
|
parserTs,
|
|
1411
1595
|
parserVue,
|
|
1412
|
-
|
|
1596
|
+
parserYaml,
|
|
1413
1597
|
pluginAntfu,
|
|
1414
1598
|
pluginAstro,
|
|
1415
1599
|
pluginComments,
|
|
@@ -1426,7 +1610,7 @@ var src_default = coderwyd;
|
|
|
1426
1610
|
pluginUnicorn,
|
|
1427
1611
|
pluginUnusedImports,
|
|
1428
1612
|
pluginVue,
|
|
1429
|
-
|
|
1613
|
+
pluginYaml,
|
|
1430
1614
|
react,
|
|
1431
1615
|
renameRules,
|
|
1432
1616
|
sortPackageJson,
|
|
@@ -1434,8 +1618,7 @@ var src_default = coderwyd;
|
|
|
1434
1618
|
stylistic,
|
|
1435
1619
|
test,
|
|
1436
1620
|
typescript,
|
|
1437
|
-
typescriptWithLanguageServer,
|
|
1438
1621
|
unicorn,
|
|
1439
1622
|
vue,
|
|
1440
|
-
|
|
1623
|
+
yaml
|
|
1441
1624
|
});
|