@coderwyd/eslint-config 1.1.0-beta.0 → 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 +1624 -0
- package/dist/index.d.cts +230 -0
- package/dist/index.d.ts +107 -31
- package/dist/index.js +908 -702
- package/package.json +26 -21
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// src/factory.ts
|
|
2
2
|
import process3 from "process";
|
|
3
|
+
import fs from "fs";
|
|
3
4
|
import { isPackageExists } from "local-pkg";
|
|
4
|
-
|
|
5
|
-
// src/flags.ts
|
|
6
|
-
var OFF = 0;
|
|
5
|
+
import gitignore from "eslint-config-flat-gitignore";
|
|
7
6
|
|
|
8
7
|
// src/plugins.ts
|
|
9
8
|
import { default as default2 } from "eslint-plugin-antfu";
|
|
@@ -13,52 +12,74 @@ import { default as default5 } from "eslint-plugin-jsdoc";
|
|
|
13
12
|
import { default as default6 } from "eslint-plugin-jsonc";
|
|
14
13
|
import { default as default7 } from "eslint-plugin-markdown";
|
|
15
14
|
import { default as default8 } from "eslint-plugin-n";
|
|
16
|
-
import { default as default9 } from "@stylistic/eslint-plugin
|
|
17
|
-
import { default as default10 } from "@
|
|
18
|
-
import { default as default11 } from "
|
|
19
|
-
import { default as default12 } from "eslint-plugin-
|
|
20
|
-
import { default as default13 } from "eslint-plugin-
|
|
21
|
-
import { default as default14 } from "eslint-plugin-
|
|
22
|
-
import { default as default15 } from "eslint-plugin-
|
|
23
|
-
import { default as default16 } from "eslint-plugin-
|
|
24
|
-
import { default as default17 } from "eslint-plugin-react";
|
|
25
|
-
import { default as default18 } from "eslint-plugin-
|
|
15
|
+
import { default as default9 } from "@stylistic/eslint-plugin";
|
|
16
|
+
import { default as default10 } from "@typescript-eslint/eslint-plugin";
|
|
17
|
+
import { default as default11 } from "eslint-plugin-unicorn";
|
|
18
|
+
import { default as default12 } from "eslint-plugin-unused-imports";
|
|
19
|
+
import { default as default13 } from "eslint-plugin-vue";
|
|
20
|
+
import { default as default14 } from "eslint-plugin-yml";
|
|
21
|
+
import { default as default15 } from "eslint-plugin-no-only-tests";
|
|
22
|
+
import { default as default16 } from "eslint-plugin-react";
|
|
23
|
+
import { default as default17 } from "eslint-plugin-react-hooks";
|
|
24
|
+
import { default as default18 } from "eslint-plugin-astro";
|
|
26
25
|
import { default as default19 } from "@typescript-eslint/parser";
|
|
27
26
|
import { default as default20 } from "vue-eslint-parser";
|
|
28
27
|
import { default as default21 } from "yaml-eslint-parser";
|
|
29
28
|
import { default as default22 } from "jsonc-eslint-parser";
|
|
29
|
+
import { default as default23 } from "astro-eslint-parser";
|
|
30
30
|
|
|
31
31
|
// src/configs/comments.ts
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
function comments() {
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
plugins: {
|
|
36
|
+
"eslint-comments": default3
|
|
37
|
+
},
|
|
38
|
+
rules: {
|
|
39
|
+
"eslint-comments/no-aggregating-enable": "error",
|
|
40
|
+
"eslint-comments/no-duplicate-disable": "error",
|
|
41
|
+
"eslint-comments/no-unlimited-disable": "error",
|
|
42
|
+
"eslint-comments/no-unused-enable": "error"
|
|
43
|
+
}
|
|
40
44
|
}
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
];
|
|
46
|
+
}
|
|
43
47
|
|
|
44
48
|
// src/globs.ts
|
|
45
49
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
46
50
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
51
|
+
var GLOB_JS = "**/*.?([cm])js";
|
|
47
52
|
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
48
53
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
49
54
|
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
55
|
+
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
56
|
+
var GLOB_CSS = "**/*.css";
|
|
57
|
+
var GLOB_LESS = "**/*.less";
|
|
58
|
+
var GLOB_SCSS = "**/*.scss";
|
|
50
59
|
var GLOB_JSON = "**/*.json";
|
|
51
60
|
var GLOB_JSON5 = "**/*.json5";
|
|
52
61
|
var GLOB_JSONC = "**/*.jsonc";
|
|
53
62
|
var GLOB_MARKDOWN = "**/*.md";
|
|
54
63
|
var GLOB_VUE = "**/*.vue";
|
|
55
64
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
65
|
+
var GLOB_HTML = "**/*.htm?(l)";
|
|
66
|
+
var GLOB_ASTRO = "**/*.astro";
|
|
56
67
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
57
68
|
var GLOB_TESTS = [
|
|
58
69
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
59
70
|
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
60
71
|
`**/*.test.${GLOB_SRC_EXT}`
|
|
61
72
|
];
|
|
73
|
+
var GLOB_ALL_SRC = [
|
|
74
|
+
GLOB_SRC,
|
|
75
|
+
GLOB_STYLE,
|
|
76
|
+
GLOB_JSON,
|
|
77
|
+
GLOB_JSON5,
|
|
78
|
+
GLOB_MARKDOWN,
|
|
79
|
+
GLOB_VUE,
|
|
80
|
+
GLOB_YAML,
|
|
81
|
+
GLOB_HTML
|
|
82
|
+
];
|
|
62
83
|
var GLOB_EXCLUDE = [
|
|
63
84
|
"**/node_modules",
|
|
64
85
|
"**/dist",
|
|
@@ -84,34 +105,61 @@ var GLOB_EXCLUDE = [
|
|
|
84
105
|
];
|
|
85
106
|
|
|
86
107
|
// src/configs/ignores.ts
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
108
|
+
function ignores() {
|
|
109
|
+
return [
|
|
110
|
+
{ ignores: GLOB_EXCLUDE }
|
|
111
|
+
];
|
|
112
|
+
}
|
|
90
113
|
|
|
91
114
|
// src/configs/imports.ts
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
115
|
+
function imports(options = {}) {
|
|
116
|
+
const {
|
|
117
|
+
stylistic: stylistic2 = true
|
|
118
|
+
} = options;
|
|
119
|
+
return [
|
|
120
|
+
{
|
|
121
|
+
plugins: {
|
|
122
|
+
antfu: default2,
|
|
123
|
+
import: default4
|
|
124
|
+
},
|
|
125
|
+
rules: {
|
|
126
|
+
"antfu/import-dedupe": "error",
|
|
127
|
+
"antfu/no-import-node-modules-by-path": "error",
|
|
128
|
+
"import/export": "error",
|
|
129
|
+
"import/first": "error",
|
|
130
|
+
"import/no-duplicates": "error",
|
|
131
|
+
"import/no-mutable-exports": "error",
|
|
132
|
+
"import/no-named-default": "error",
|
|
133
|
+
"import/no-self-import": "error",
|
|
134
|
+
"import/no-webpack-loader-syntax": "error",
|
|
135
|
+
"import/order": "error",
|
|
136
|
+
...stylistic2 ? {
|
|
137
|
+
"import/newline-after-import": ["error", { considerComments: true, count: 1 }]
|
|
138
|
+
} : {}
|
|
139
|
+
}
|
|
107
140
|
}
|
|
108
|
-
|
|
109
|
-
|
|
141
|
+
];
|
|
142
|
+
}
|
|
110
143
|
|
|
111
144
|
// src/configs/javascript.ts
|
|
112
145
|
import globals from "globals";
|
|
146
|
+
|
|
147
|
+
// src/flags.ts
|
|
148
|
+
var OFF = 0;
|
|
149
|
+
|
|
150
|
+
// src/configs/javascript.ts
|
|
113
151
|
function javascript(options = {}) {
|
|
152
|
+
const {
|
|
153
|
+
isInEditor = false,
|
|
154
|
+
overrides = {}
|
|
155
|
+
} = options;
|
|
114
156
|
return [
|
|
157
|
+
{
|
|
158
|
+
plugins: {
|
|
159
|
+
"antfu": default2,
|
|
160
|
+
"unused-imports": default12
|
|
161
|
+
}
|
|
162
|
+
},
|
|
115
163
|
{
|
|
116
164
|
languageOptions: {
|
|
117
165
|
ecmaVersion: 2022,
|
|
@@ -132,21 +180,12 @@ function javascript(options = {}) {
|
|
|
132
180
|
},
|
|
133
181
|
sourceType: "module"
|
|
134
182
|
},
|
|
135
|
-
plugins: {
|
|
136
|
-
"antfu": default2,
|
|
137
|
-
"unused-imports": default13
|
|
138
|
-
},
|
|
139
183
|
rules: {
|
|
140
184
|
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
141
|
-
"antfu/import-dedupe": "error",
|
|
142
|
-
"antfu/no-import-node-modules-by-path": "error",
|
|
143
185
|
"antfu/top-level-function": "error",
|
|
144
186
|
"array-callback-return": "error",
|
|
145
187
|
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
146
188
|
"block-scoped-var": "error",
|
|
147
|
-
"camelcase": OFF,
|
|
148
|
-
"complexity": OFF,
|
|
149
|
-
"consistent-return": OFF,
|
|
150
189
|
"constructor-super": "error",
|
|
151
190
|
"default-case-last": "error",
|
|
152
191
|
"dot-notation": ["error", { allowKeywords: true }],
|
|
@@ -155,7 +194,7 @@ function javascript(options = {}) {
|
|
|
155
194
|
"max-statements-per-line": ["error", { max: 1 }],
|
|
156
195
|
"new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
|
|
157
196
|
"new-parens": "error",
|
|
158
|
-
"no-alert": "
|
|
197
|
+
"no-alert": "error",
|
|
159
198
|
"no-array-constructor": "error",
|
|
160
199
|
"no-async-promise-executor": "error",
|
|
161
200
|
"no-caller": "error",
|
|
@@ -213,7 +252,6 @@ function javascript(options = {}) {
|
|
|
213
252
|
"no-obj-calls": "error",
|
|
214
253
|
"no-octal": "error",
|
|
215
254
|
"no-octal-escape": "error",
|
|
216
|
-
"no-param-reassign": OFF,
|
|
217
255
|
"no-proto": "error",
|
|
218
256
|
"no-prototype-builtins": "error",
|
|
219
257
|
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
@@ -237,8 +275,6 @@ function javascript(options = {}) {
|
|
|
237
275
|
"LabeledStatement",
|
|
238
276
|
"WithStatement"
|
|
239
277
|
],
|
|
240
|
-
"no-return-assign": OFF,
|
|
241
|
-
"no-return-await": OFF,
|
|
242
278
|
"no-self-assign": ["error", { props: true }],
|
|
243
279
|
"no-self-compare": "error",
|
|
244
280
|
"no-sequences": "error",
|
|
@@ -273,7 +309,6 @@ function javascript(options = {}) {
|
|
|
273
309
|
"no-useless-catch": "error",
|
|
274
310
|
"no-useless-computed-key": "error",
|
|
275
311
|
"no-useless-constructor": "error",
|
|
276
|
-
"no-useless-escape": OFF,
|
|
277
312
|
"no-useless-rename": "error",
|
|
278
313
|
"no-useless-return": "error",
|
|
279
314
|
"no-var": "error",
|
|
@@ -309,7 +344,6 @@ function javascript(options = {}) {
|
|
|
309
344
|
"prefer-spread": "error",
|
|
310
345
|
"prefer-template": "error",
|
|
311
346
|
"quote-props": ["error", "consistent-as-needed"],
|
|
312
|
-
"require-await": OFF,
|
|
313
347
|
"sort-imports": [
|
|
314
348
|
"error",
|
|
315
349
|
{
|
|
@@ -322,20 +356,21 @@ function javascript(options = {}) {
|
|
|
322
356
|
],
|
|
323
357
|
"symbol-description": "error",
|
|
324
358
|
"unicode-bom": ["error", "never"],
|
|
325
|
-
"unused-imports/no-unused-imports":
|
|
359
|
+
"unused-imports/no-unused-imports": isInEditor ? OFF : "error",
|
|
326
360
|
"unused-imports/no-unused-vars": [
|
|
327
|
-
"
|
|
361
|
+
"error",
|
|
328
362
|
{ args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^_" }
|
|
329
363
|
],
|
|
330
364
|
"use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
|
|
331
365
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
332
366
|
"vars-on-top": "error",
|
|
333
367
|
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
334
|
-
"yoda": ["error", "never"]
|
|
368
|
+
"yoda": ["error", "never"],
|
|
369
|
+
...overrides
|
|
335
370
|
}
|
|
336
371
|
},
|
|
337
372
|
{
|
|
338
|
-
files: [
|
|
373
|
+
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
339
374
|
rules: {
|
|
340
375
|
"no-console": OFF
|
|
341
376
|
}
|
|
@@ -344,65 +379,119 @@ function javascript(options = {}) {
|
|
|
344
379
|
}
|
|
345
380
|
|
|
346
381
|
// src/configs/jsdoc.ts
|
|
347
|
-
|
|
348
|
-
{
|
|
349
|
-
|
|
350
|
-
|
|
382
|
+
function jsdoc(options = {}) {
|
|
383
|
+
const {
|
|
384
|
+
stylistic: stylistic2 = true
|
|
385
|
+
} = options;
|
|
386
|
+
return [
|
|
387
|
+
{
|
|
388
|
+
plugins: {
|
|
389
|
+
jsdoc: default5
|
|
390
|
+
}
|
|
351
391
|
},
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
392
|
+
{
|
|
393
|
+
rules: {
|
|
394
|
+
"jsdoc/check-access": "warn",
|
|
395
|
+
"jsdoc/check-param-names": "warn",
|
|
396
|
+
"jsdoc/check-property-names": "warn",
|
|
397
|
+
"jsdoc/check-types": "warn",
|
|
398
|
+
"jsdoc/empty-tags": "warn",
|
|
399
|
+
"jsdoc/implements-on-classes": "warn",
|
|
400
|
+
"jsdoc/no-defaults": "warn",
|
|
401
|
+
"jsdoc/no-multi-asterisks": "warn",
|
|
402
|
+
"jsdoc/require-param-name": "warn",
|
|
403
|
+
"jsdoc/require-property": "warn",
|
|
404
|
+
"jsdoc/require-property-description": "warn",
|
|
405
|
+
"jsdoc/require-property-name": "warn",
|
|
406
|
+
"jsdoc/require-returns-check": "warn",
|
|
407
|
+
"jsdoc/require-returns-description": "warn",
|
|
408
|
+
"jsdoc/require-yields-check": "warn",
|
|
409
|
+
"jsdoc/valid-types": "warn",
|
|
410
|
+
...stylistic2 ? {
|
|
411
|
+
"jsdoc/check-alignment": "warn",
|
|
412
|
+
"jsdoc/multiline-blocks": "warn"
|
|
413
|
+
} : {}
|
|
414
|
+
}
|
|
366
415
|
}
|
|
367
|
-
|
|
368
|
-
|
|
416
|
+
];
|
|
417
|
+
}
|
|
369
418
|
|
|
370
419
|
// src/configs/jsonc.ts
|
|
371
|
-
|
|
372
|
-
{
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
420
|
+
function jsonc(options = {}) {
|
|
421
|
+
const {
|
|
422
|
+
stylistic: stylistic2 = true,
|
|
423
|
+
overrides = {}
|
|
424
|
+
} = options;
|
|
425
|
+
return [
|
|
426
|
+
{
|
|
427
|
+
plugins: {
|
|
428
|
+
jsonc: default6
|
|
429
|
+
}
|
|
379
430
|
},
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
431
|
+
{
|
|
432
|
+
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
433
|
+
languageOptions: {
|
|
434
|
+
parser: default22
|
|
435
|
+
},
|
|
436
|
+
rules: {
|
|
437
|
+
"jsonc/no-bigint-literals": "error",
|
|
438
|
+
"jsonc/no-binary-expression": "error",
|
|
439
|
+
"jsonc/no-binary-numeric-literals": "error",
|
|
440
|
+
"jsonc/no-dupe-keys": "error",
|
|
441
|
+
"jsonc/no-escape-sequence-in-identifier": "error",
|
|
442
|
+
"jsonc/no-floating-decimal": "error",
|
|
443
|
+
"jsonc/no-hexadecimal-numeric-literals": "error",
|
|
444
|
+
"jsonc/no-infinity": "error",
|
|
445
|
+
"jsonc/no-multi-str": "error",
|
|
446
|
+
"jsonc/no-nan": "error",
|
|
447
|
+
"jsonc/no-number-props": "error",
|
|
448
|
+
"jsonc/no-numeric-separators": "error",
|
|
449
|
+
"jsonc/no-octal": "error",
|
|
450
|
+
"jsonc/no-octal-escape": "error",
|
|
451
|
+
"jsonc/no-octal-numeric-literals": "error",
|
|
452
|
+
"jsonc/no-parenthesized": "error",
|
|
453
|
+
"jsonc/no-plus-sign": "error",
|
|
454
|
+
"jsonc/no-regexp-literals": "error",
|
|
455
|
+
"jsonc/no-sparse-arrays": "error",
|
|
456
|
+
"jsonc/no-template-literals": "error",
|
|
457
|
+
"jsonc/no-undefined-value": "error",
|
|
458
|
+
"jsonc/no-unicode-codepoint-escapes": "error",
|
|
459
|
+
"jsonc/no-useless-escape": "error",
|
|
460
|
+
"jsonc/space-unary-ops": "error",
|
|
461
|
+
"jsonc/valid-json-number": "error",
|
|
462
|
+
"jsonc/vue-custom-block/no-parsing-error": "error",
|
|
463
|
+
...stylistic2 ? {
|
|
464
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
465
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
466
|
+
"jsonc/comma-style": ["error", "last"],
|
|
467
|
+
"jsonc/indent": ["error", 2],
|
|
468
|
+
"jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
469
|
+
"jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
470
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
471
|
+
"jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
472
|
+
"jsonc/quote-props": "error",
|
|
473
|
+
"jsonc/quotes": "error"
|
|
474
|
+
} : {},
|
|
475
|
+
...overrides
|
|
476
|
+
}
|
|
391
477
|
}
|
|
392
|
-
|
|
393
|
-
|
|
478
|
+
];
|
|
479
|
+
}
|
|
394
480
|
|
|
395
481
|
// src/configs/markdown.ts
|
|
396
482
|
function markdown(options = {}) {
|
|
397
483
|
const {
|
|
398
|
-
componentExts = []
|
|
484
|
+
componentExts = [],
|
|
485
|
+
overrides = {}
|
|
399
486
|
} = options;
|
|
400
487
|
return [
|
|
401
488
|
{
|
|
402
|
-
files: [GLOB_MARKDOWN],
|
|
403
489
|
plugins: {
|
|
404
490
|
markdown: default7
|
|
405
|
-
}
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
files: [GLOB_MARKDOWN],
|
|
406
495
|
processor: "markdown/markdown"
|
|
407
496
|
},
|
|
408
497
|
{
|
|
@@ -417,22 +506,17 @@ function markdown(options = {}) {
|
|
|
417
506
|
}
|
|
418
507
|
}
|
|
419
508
|
},
|
|
420
|
-
plugins: {
|
|
421
|
-
ts: default11
|
|
422
|
-
},
|
|
423
509
|
rules: {
|
|
424
|
-
...default7.configs.recommended.overrides[1].rules,
|
|
425
510
|
"antfu/no-cjs-exports": OFF,
|
|
426
511
|
"antfu/no-ts-export-equal": OFF,
|
|
427
|
-
"
|
|
512
|
+
"eol-last": OFF,
|
|
428
513
|
"no-alert": OFF,
|
|
429
514
|
"no-console": OFF,
|
|
430
|
-
"no-restricted-imports": OFF,
|
|
431
515
|
"no-undef": OFF,
|
|
432
516
|
"no-unused-expressions": OFF,
|
|
433
517
|
"no-unused-vars": OFF,
|
|
434
518
|
"node/prefer-global/process": OFF,
|
|
435
|
-
"
|
|
519
|
+
"style/comma-dangle": OFF,
|
|
436
520
|
"ts/consistent-type-imports": OFF,
|
|
437
521
|
"ts/no-namespace": OFF,
|
|
438
522
|
"ts/no-redeclare": OFF,
|
|
@@ -440,385 +524,371 @@ function markdown(options = {}) {
|
|
|
440
524
|
"ts/no-unused-vars": OFF,
|
|
441
525
|
"ts/no-use-before-define": OFF,
|
|
442
526
|
"ts/no-var-requires": OFF,
|
|
527
|
+
"unicode-bom": "off",
|
|
443
528
|
"unused-imports/no-unused-imports": OFF,
|
|
444
|
-
"unused-imports/no-unused-vars": OFF
|
|
529
|
+
"unused-imports/no-unused-vars": OFF,
|
|
530
|
+
// Type aware rules
|
|
531
|
+
...{
|
|
532
|
+
"ts/await-thenable": OFF,
|
|
533
|
+
"ts/dot-notation": OFF,
|
|
534
|
+
"ts/no-floating-promises": OFF,
|
|
535
|
+
"ts/no-for-in-array": OFF,
|
|
536
|
+
"ts/no-implied-eval": OFF,
|
|
537
|
+
"ts/no-misused-promises": OFF,
|
|
538
|
+
"ts/no-throw-literal": OFF,
|
|
539
|
+
"ts/no-unnecessary-type-assertion": OFF,
|
|
540
|
+
"ts/no-unsafe-argument": OFF,
|
|
541
|
+
"ts/no-unsafe-assignment": OFF,
|
|
542
|
+
"ts/no-unsafe-call": OFF,
|
|
543
|
+
"ts/no-unsafe-member-access": OFF,
|
|
544
|
+
"ts/no-unsafe-return": OFF,
|
|
545
|
+
"ts/restrict-plus-operands": OFF,
|
|
546
|
+
"ts/restrict-template-expressions": OFF,
|
|
547
|
+
"ts/unbound-method": OFF
|
|
548
|
+
},
|
|
549
|
+
...overrides
|
|
445
550
|
}
|
|
446
551
|
}
|
|
447
552
|
];
|
|
448
553
|
}
|
|
449
554
|
|
|
450
555
|
// src/configs/node.ts
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
556
|
+
function node() {
|
|
557
|
+
return [
|
|
558
|
+
{
|
|
559
|
+
plugins: {
|
|
560
|
+
node: default8
|
|
561
|
+
},
|
|
562
|
+
rules: {
|
|
563
|
+
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
564
|
+
"node/no-deprecated-api": "error",
|
|
565
|
+
"node/no-exports-assign": "error",
|
|
566
|
+
"node/no-new-require": "error",
|
|
567
|
+
"node/no-path-concat": "error",
|
|
568
|
+
"node/prefer-global/buffer": ["error", "never"],
|
|
569
|
+
"node/prefer-global/process": ["error", "never"],
|
|
570
|
+
"node/process-exit-as-throw": "error"
|
|
571
|
+
}
|
|
465
572
|
}
|
|
466
|
-
|
|
467
|
-
|
|
573
|
+
];
|
|
574
|
+
}
|
|
468
575
|
|
|
469
576
|
// src/configs/sort.ts
|
|
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
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
577
|
+
function sortPackageJson() {
|
|
578
|
+
return [
|
|
579
|
+
{
|
|
580
|
+
files: ["**/package.json"],
|
|
581
|
+
rules: {
|
|
582
|
+
"jsonc/sort-array-values": [
|
|
583
|
+
"error",
|
|
584
|
+
{
|
|
585
|
+
order: { type: "asc" },
|
|
586
|
+
pathPattern: "^files$"
|
|
587
|
+
}
|
|
588
|
+
],
|
|
589
|
+
"jsonc/sort-keys": [
|
|
590
|
+
"error",
|
|
591
|
+
{
|
|
592
|
+
order: [
|
|
593
|
+
"publisher",
|
|
594
|
+
"name",
|
|
595
|
+
"displayName",
|
|
596
|
+
"type",
|
|
597
|
+
"version",
|
|
598
|
+
"private",
|
|
599
|
+
"packageManager",
|
|
600
|
+
"description",
|
|
601
|
+
"author",
|
|
602
|
+
"license",
|
|
603
|
+
"funding",
|
|
604
|
+
"homepage",
|
|
605
|
+
"repository",
|
|
606
|
+
"bugs",
|
|
607
|
+
"keywords",
|
|
608
|
+
"categories",
|
|
609
|
+
"sideEffects",
|
|
610
|
+
"exports",
|
|
611
|
+
"main",
|
|
612
|
+
"module",
|
|
613
|
+
"unpkg",
|
|
614
|
+
"jsdelivr",
|
|
615
|
+
"types",
|
|
616
|
+
"typesVersions",
|
|
617
|
+
"bin",
|
|
618
|
+
"icon",
|
|
619
|
+
"files",
|
|
620
|
+
"engines",
|
|
621
|
+
"activationEvents",
|
|
622
|
+
"contributes",
|
|
623
|
+
"scripts",
|
|
624
|
+
"peerDependencies",
|
|
625
|
+
"peerDependenciesMeta",
|
|
626
|
+
"dependencies",
|
|
627
|
+
"optionalDependencies",
|
|
628
|
+
"devDependencies",
|
|
629
|
+
"pnpm",
|
|
630
|
+
"overrides",
|
|
631
|
+
"resolutions",
|
|
632
|
+
"husky",
|
|
633
|
+
"simple-git-hooks",
|
|
634
|
+
"lint-staged",
|
|
635
|
+
"nano-staged",
|
|
636
|
+
"eslintConfig"
|
|
637
|
+
],
|
|
638
|
+
pathPattern: "^$"
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
order: { type: "asc" },
|
|
642
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
order: { type: "asc" },
|
|
646
|
+
pathPattern: "^resolutions$"
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
order: { type: "asc" },
|
|
650
|
+
pathPattern: "^pnpm.overrides$"
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
order: [
|
|
654
|
+
"types",
|
|
655
|
+
"import",
|
|
656
|
+
"require",
|
|
657
|
+
"default"
|
|
658
|
+
],
|
|
659
|
+
pathPattern: "^exports.*$"
|
|
660
|
+
}
|
|
661
|
+
]
|
|
662
|
+
}
|
|
553
663
|
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
"
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
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
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
664
|
+
];
|
|
665
|
+
}
|
|
666
|
+
function sortTsconfig() {
|
|
667
|
+
return [
|
|
668
|
+
{
|
|
669
|
+
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
670
|
+
rules: {
|
|
671
|
+
"jsonc/sort-keys": [
|
|
672
|
+
"error",
|
|
673
|
+
{
|
|
674
|
+
order: [
|
|
675
|
+
"extends",
|
|
676
|
+
"compilerOptions",
|
|
677
|
+
"references",
|
|
678
|
+
"files",
|
|
679
|
+
"include",
|
|
680
|
+
"exclude"
|
|
681
|
+
],
|
|
682
|
+
pathPattern: "^$"
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
order: [
|
|
686
|
+
/* Projects */
|
|
687
|
+
"incremental",
|
|
688
|
+
"composite",
|
|
689
|
+
"tsBuildInfoFile",
|
|
690
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
691
|
+
"disableSolutionSearching",
|
|
692
|
+
"disableReferencedProjectLoad",
|
|
693
|
+
/* Language and Environment */
|
|
694
|
+
"target",
|
|
695
|
+
"lib",
|
|
696
|
+
"jsx",
|
|
697
|
+
"experimentalDecorators",
|
|
698
|
+
"emitDecoratorMetadata",
|
|
699
|
+
"jsxFactory",
|
|
700
|
+
"jsxFragmentFactory",
|
|
701
|
+
"jsxImportSource",
|
|
702
|
+
"reactNamespace",
|
|
703
|
+
"noLib",
|
|
704
|
+
"useDefineForClassFields",
|
|
705
|
+
"moduleDetection",
|
|
706
|
+
/* Modules */
|
|
707
|
+
"module",
|
|
708
|
+
"rootDir",
|
|
709
|
+
"moduleResolution",
|
|
710
|
+
"baseUrl",
|
|
711
|
+
"paths",
|
|
712
|
+
"rootDirs",
|
|
713
|
+
"typeRoots",
|
|
714
|
+
"types",
|
|
715
|
+
"allowUmdGlobalAccess",
|
|
716
|
+
"moduleSuffixes",
|
|
717
|
+
"allowImportingTsExtensions",
|
|
718
|
+
"resolvePackageJsonExports",
|
|
719
|
+
"resolvePackageJsonImports",
|
|
720
|
+
"customConditions",
|
|
721
|
+
"resolveJsonModule",
|
|
722
|
+
"allowArbitraryExtensions",
|
|
723
|
+
"noResolve",
|
|
724
|
+
/* JavaScript Support */
|
|
725
|
+
"allowJs",
|
|
726
|
+
"checkJs",
|
|
727
|
+
"maxNodeModuleJsDepth",
|
|
728
|
+
/* Emit */
|
|
729
|
+
"declaration",
|
|
730
|
+
"declarationMap",
|
|
731
|
+
"emitDeclarationOnly",
|
|
732
|
+
"sourceMap",
|
|
733
|
+
"inlineSourceMap",
|
|
734
|
+
"outFile",
|
|
735
|
+
"outDir",
|
|
736
|
+
"removeComments",
|
|
737
|
+
"noEmit",
|
|
738
|
+
"importHelpers",
|
|
739
|
+
"importsNotUsedAsValues",
|
|
740
|
+
"downlevelIteration",
|
|
741
|
+
"sourceRoot",
|
|
742
|
+
"mapRoot",
|
|
743
|
+
"inlineSources",
|
|
744
|
+
"emitBOM",
|
|
745
|
+
"newLine",
|
|
746
|
+
"stripInternal",
|
|
747
|
+
"noEmitHelpers",
|
|
748
|
+
"noEmitOnError",
|
|
749
|
+
"preserveConstEnums",
|
|
750
|
+
"declarationDir",
|
|
751
|
+
"preserveValueImports",
|
|
752
|
+
/* Interop Constraints */
|
|
753
|
+
"isolatedModules",
|
|
754
|
+
"verbatimModuleSyntax",
|
|
755
|
+
"allowSyntheticDefaultImports",
|
|
756
|
+
"esModuleInterop",
|
|
757
|
+
"preserveSymlinks",
|
|
758
|
+
"forceConsistentCasingInFileNames",
|
|
759
|
+
/* Type Checking */
|
|
760
|
+
"strict",
|
|
761
|
+
"strictBindCallApply",
|
|
762
|
+
"strictFunctionTypes",
|
|
763
|
+
"strictNullChecks",
|
|
764
|
+
"strictPropertyInitialization",
|
|
765
|
+
"allowUnreachableCode",
|
|
766
|
+
"allowUnusedLabels",
|
|
767
|
+
"alwaysStrict",
|
|
768
|
+
"exactOptionalPropertyTypes",
|
|
769
|
+
"noFallthroughCasesInSwitch",
|
|
770
|
+
"noImplicitAny",
|
|
771
|
+
"noImplicitOverride",
|
|
772
|
+
"noImplicitReturns",
|
|
773
|
+
"noImplicitThis",
|
|
774
|
+
"noPropertyAccessFromIndexSignature",
|
|
775
|
+
"noUncheckedIndexedAccess",
|
|
776
|
+
"noUnusedLocals",
|
|
777
|
+
"noUnusedParameters",
|
|
778
|
+
"useUnknownInCatchVariables",
|
|
779
|
+
/* Completeness */
|
|
780
|
+
"skipDefaultLibCheck",
|
|
781
|
+
"skipLibCheck"
|
|
782
|
+
],
|
|
783
|
+
pathPattern: "^compilerOptions$"
|
|
784
|
+
}
|
|
785
|
+
]
|
|
786
|
+
}
|
|
675
787
|
}
|
|
676
|
-
|
|
677
|
-
|
|
788
|
+
];
|
|
789
|
+
}
|
|
678
790
|
|
|
679
791
|
// src/configs/stylistic.ts
|
|
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
|
-
var typescriptStylistic = [
|
|
781
|
-
{
|
|
782
|
-
plugins: {
|
|
783
|
-
"style-ts": default10,
|
|
784
|
-
"ts": default11
|
|
785
|
-
},
|
|
786
|
-
rules: {
|
|
787
|
-
...stylisticJsToTS(javascriptStylistic[0].rules),
|
|
788
|
-
"comma-dangle": OFF,
|
|
789
|
-
"quotes": OFF,
|
|
790
|
-
"semi": OFF,
|
|
791
|
-
"style-ts/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
792
|
-
"style-ts/type-annotation-spacing": ["error", {}],
|
|
793
|
-
"ts/comma-dangle": ["error", "always-multiline"],
|
|
794
|
-
"ts/quotes": ["error", "single"],
|
|
795
|
-
"ts/semi": ["error", "never"]
|
|
792
|
+
function stylistic() {
|
|
793
|
+
return [
|
|
794
|
+
{
|
|
795
|
+
plugins: {
|
|
796
|
+
antfu: default2,
|
|
797
|
+
style: default9
|
|
798
|
+
},
|
|
799
|
+
rules: {
|
|
800
|
+
"antfu/consistent-list-newline": "error",
|
|
801
|
+
"antfu/if-newline": "error",
|
|
802
|
+
"curly": ["error", "multi-or-nest", "consistent"],
|
|
803
|
+
"style/array-bracket-spacing": ["error", "never"],
|
|
804
|
+
"style/arrow-spacing": ["error", { after: true, before: true }],
|
|
805
|
+
"style/block-spacing": ["error", "always"],
|
|
806
|
+
"style/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
807
|
+
"style/comma-dangle": ["error", "always-multiline"],
|
|
808
|
+
"style/comma-spacing": ["error", { after: true, before: false }],
|
|
809
|
+
"style/comma-style": ["error", "last"],
|
|
810
|
+
"style/computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
|
|
811
|
+
"style/dot-location": ["error", "property"],
|
|
812
|
+
"style/indent": ["error", 2, {
|
|
813
|
+
ArrayExpression: 1,
|
|
814
|
+
CallExpression: { arguments: 1 },
|
|
815
|
+
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
816
|
+
FunctionExpression: { body: 1, parameters: 1 },
|
|
817
|
+
ImportDeclaration: 1,
|
|
818
|
+
MemberExpression: 1,
|
|
819
|
+
ObjectExpression: 1,
|
|
820
|
+
SwitchCase: 1,
|
|
821
|
+
VariableDeclarator: 1,
|
|
822
|
+
flatTernaryExpressions: false,
|
|
823
|
+
ignoreComments: false,
|
|
824
|
+
ignoredNodes: [
|
|
825
|
+
"TemplateLiteral *",
|
|
826
|
+
"JSXElement",
|
|
827
|
+
"JSXElement > *",
|
|
828
|
+
"JSXAttribute",
|
|
829
|
+
"JSXIdentifier",
|
|
830
|
+
"JSXNamespacedName",
|
|
831
|
+
"JSXMemberExpression",
|
|
832
|
+
"JSXSpreadAttribute",
|
|
833
|
+
"JSXExpressionContainer",
|
|
834
|
+
"JSXOpeningElement",
|
|
835
|
+
"JSXClosingElement",
|
|
836
|
+
"JSXFragment",
|
|
837
|
+
"JSXOpeningFragment",
|
|
838
|
+
"JSXClosingFragment",
|
|
839
|
+
"JSXText",
|
|
840
|
+
"JSXEmptyExpression",
|
|
841
|
+
"JSXSpreadChild",
|
|
842
|
+
"TSTypeParameterInstantiation",
|
|
843
|
+
"FunctionExpression > .params[decorators.length > 0]",
|
|
844
|
+
"FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
|
|
845
|
+
"ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
|
|
846
|
+
],
|
|
847
|
+
offsetTernaryExpressions: true,
|
|
848
|
+
outerIIFEBody: 1
|
|
849
|
+
}],
|
|
850
|
+
"style/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
851
|
+
"style/keyword-spacing": ["error", { after: true, before: true }],
|
|
852
|
+
"style/lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
|
|
853
|
+
"style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
854
|
+
"style/multiline-ternary": ["error", "always-multiline"],
|
|
855
|
+
"style/no-mixed-spaces-and-tabs": "error",
|
|
856
|
+
"style/no-multi-spaces": "error",
|
|
857
|
+
"style/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
858
|
+
"style/no-tabs": "error",
|
|
859
|
+
"style/no-trailing-spaces": "error",
|
|
860
|
+
"style/no-whitespace-before-property": "error",
|
|
861
|
+
"style/object-curly-spacing": ["error", "always"],
|
|
862
|
+
"style/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
863
|
+
"style/operator-linebreak": ["error", "before"],
|
|
864
|
+
"style/padded-blocks": ["error", { blocks: "never", classes: "never", switches: "never" }],
|
|
865
|
+
"style/quotes": ["error", "single"],
|
|
866
|
+
"style/rest-spread-spacing": ["error", "never"],
|
|
867
|
+
"style/semi": ["error", "never"],
|
|
868
|
+
"style/semi-spacing": ["error", { after: true, before: false }],
|
|
869
|
+
"style/space-before-blocks": ["error", "always"],
|
|
870
|
+
"style/space-before-function-paren": ["error", { anonymous: "always", asyncArrow: "always", named: "never" }],
|
|
871
|
+
"style/space-in-parens": ["error", "never"],
|
|
872
|
+
"style/space-infix-ops": "error",
|
|
873
|
+
"style/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
874
|
+
"style/spaced-comment": ["error", "always", {
|
|
875
|
+
block: {
|
|
876
|
+
balanced: true,
|
|
877
|
+
exceptions: ["*"],
|
|
878
|
+
markers: ["!"]
|
|
879
|
+
},
|
|
880
|
+
line: {
|
|
881
|
+
exceptions: ["/", "#"],
|
|
882
|
+
markers: ["/"]
|
|
883
|
+
}
|
|
884
|
+
}],
|
|
885
|
+
"style/template-curly-spacing": "error",
|
|
886
|
+
"style/template-tag-spacing": ["error", "never"],
|
|
887
|
+
"style/type-annotation-spacing": ["error", {}],
|
|
888
|
+
"style/yield-star-spacing": ["error", "both"]
|
|
889
|
+
}
|
|
796
890
|
}
|
|
797
|
-
|
|
798
|
-
];
|
|
799
|
-
function stylisticJsToTS(input) {
|
|
800
|
-
return {
|
|
801
|
-
// turn off all stylistic rules from style
|
|
802
|
-
...Object.fromEntries(
|
|
803
|
-
Object.entries(input).map(([key]) => {
|
|
804
|
-
if (!key.startsWith("style/"))
|
|
805
|
-
return null;
|
|
806
|
-
const basename = key.replace("style/", "");
|
|
807
|
-
if (tsPackage.rules.find((i) => i.name === basename))
|
|
808
|
-
return [key, OFF];
|
|
809
|
-
return null;
|
|
810
|
-
}).filter(Boolean)
|
|
811
|
-
),
|
|
812
|
-
// rename all stylistic rules from style to style/ts
|
|
813
|
-
...Object.fromEntries(
|
|
814
|
-
Object.entries(input).map(([key, value]) => {
|
|
815
|
-
if (!key.startsWith("style/"))
|
|
816
|
-
return null;
|
|
817
|
-
const basename = key.replace("style/", "");
|
|
818
|
-
return tsPackage.rules.find((i) => i.name === basename) ? [`style-ts/${basename}`, value] : null;
|
|
819
|
-
}).filter(Boolean)
|
|
820
|
-
)
|
|
821
|
-
};
|
|
891
|
+
];
|
|
822
892
|
}
|
|
823
893
|
|
|
824
894
|
// src/configs/typescript.ts
|
|
@@ -841,9 +911,40 @@ function renameRules(rules, from, to) {
|
|
|
841
911
|
// src/configs/typescript.ts
|
|
842
912
|
function typescript(options) {
|
|
843
913
|
const {
|
|
844
|
-
componentExts = []
|
|
914
|
+
componentExts = [],
|
|
915
|
+
overrides = {},
|
|
916
|
+
parserOptions = {},
|
|
917
|
+
tsconfigPath
|
|
845
918
|
} = options ?? {};
|
|
919
|
+
const typeAwareRules = {
|
|
920
|
+
"dot-notation": OFF,
|
|
921
|
+
"no-implied-eval": OFF,
|
|
922
|
+
"no-throw-literal": OFF,
|
|
923
|
+
"ts/await-thenable": "error",
|
|
924
|
+
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
925
|
+
"ts/no-floating-promises": "error",
|
|
926
|
+
"ts/no-for-in-array": "error",
|
|
927
|
+
"ts/no-implied-eval": "error",
|
|
928
|
+
"ts/no-misused-promises": "error",
|
|
929
|
+
"ts/no-throw-literal": "error",
|
|
930
|
+
"ts/no-unnecessary-type-assertion": "error",
|
|
931
|
+
"ts/no-unsafe-argument": "error",
|
|
932
|
+
"ts/no-unsafe-assignment": "error",
|
|
933
|
+
"ts/no-unsafe-call": "error",
|
|
934
|
+
"ts/no-unsafe-member-access": "error",
|
|
935
|
+
"ts/no-unsafe-return": "error",
|
|
936
|
+
"ts/restrict-plus-operands": "error",
|
|
937
|
+
"ts/restrict-template-expressions": "error",
|
|
938
|
+
"ts/unbound-method": "error"
|
|
939
|
+
};
|
|
846
940
|
return [
|
|
941
|
+
{
|
|
942
|
+
plugins: {
|
|
943
|
+
antfu: default2,
|
|
944
|
+
import: default4,
|
|
945
|
+
ts: default10
|
|
946
|
+
}
|
|
947
|
+
},
|
|
847
948
|
{
|
|
848
949
|
files: [
|
|
849
950
|
GLOB_TS,
|
|
@@ -853,22 +954,22 @@ function typescript(options) {
|
|
|
853
954
|
languageOptions: {
|
|
854
955
|
parser: default19,
|
|
855
956
|
parserOptions: {
|
|
856
|
-
sourceType: "module"
|
|
957
|
+
sourceType: "module",
|
|
958
|
+
...tsconfigPath ? {
|
|
959
|
+
project: [tsconfigPath],
|
|
960
|
+
tsconfigRootDir: process.cwd()
|
|
961
|
+
} : {},
|
|
962
|
+
...parserOptions
|
|
857
963
|
}
|
|
858
964
|
},
|
|
859
|
-
plugins: {
|
|
860
|
-
antfu: default2,
|
|
861
|
-
import: default4,
|
|
862
|
-
ts: default11
|
|
863
|
-
},
|
|
864
965
|
rules: {
|
|
865
966
|
...renameRules(
|
|
866
|
-
|
|
967
|
+
default10.configs["eslint-recommended"].overrides[0].rules,
|
|
867
968
|
"@typescript-eslint/",
|
|
868
969
|
"ts/"
|
|
869
970
|
),
|
|
870
971
|
...renameRules(
|
|
871
|
-
|
|
972
|
+
default10.configs.strict.rules,
|
|
872
973
|
"@typescript-eslint/",
|
|
873
974
|
"ts/"
|
|
874
975
|
),
|
|
@@ -886,30 +987,24 @@ function typescript(options) {
|
|
|
886
987
|
"no-useless-constructor": OFF,
|
|
887
988
|
// TS
|
|
888
989
|
"ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
|
|
889
|
-
"ts/ban-ts-ignore": OFF,
|
|
890
|
-
"ts/consistent-indexed-object-style": OFF,
|
|
891
990
|
"ts/consistent-type-definitions": ["error", "interface"],
|
|
892
991
|
"ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
|
|
893
|
-
"ts/explicit-function-return-type": OFF,
|
|
894
|
-
"ts/explicit-member-accessibility": OFF,
|
|
895
|
-
"ts/explicit-module-boundary-types": OFF,
|
|
896
|
-
"ts/naming-convention": OFF,
|
|
897
992
|
"ts/no-dupe-class-members": "error",
|
|
898
|
-
"ts/no-
|
|
899
|
-
"ts/no-empty-interface": OFF,
|
|
993
|
+
"ts/no-dynamic-delete": OFF,
|
|
900
994
|
"ts/no-explicit-any": OFF,
|
|
901
995
|
"ts/no-extra-parens": ["error", "functions"],
|
|
902
996
|
"ts/no-invalid-this": "error",
|
|
903
|
-
"ts/no-loss-of-precision": "error",
|
|
904
997
|
"ts/no-invalid-void-type": OFF,
|
|
998
|
+
"ts/no-loss-of-precision": "error",
|
|
905
999
|
"ts/no-non-null-assertion": OFF,
|
|
906
1000
|
"ts/no-redeclare": "error",
|
|
907
1001
|
"ts/no-require-imports": "error",
|
|
908
1002
|
"ts/no-unused-vars": OFF,
|
|
909
1003
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
910
|
-
"ts/parameter-properties": OFF,
|
|
911
1004
|
"ts/prefer-ts-expect-error": "error",
|
|
912
|
-
"ts/triple-slash-reference": OFF
|
|
1005
|
+
"ts/triple-slash-reference": OFF,
|
|
1006
|
+
...tsconfigPath ? typeAwareRules : {},
|
|
1007
|
+
...overrides
|
|
913
1008
|
}
|
|
914
1009
|
},
|
|
915
1010
|
{
|
|
@@ -935,96 +1030,50 @@ function typescript(options) {
|
|
|
935
1030
|
}
|
|
936
1031
|
];
|
|
937
1032
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
tsconfigPath,
|
|
942
|
-
tsconfigRootDir = process.cwd()
|
|
943
|
-
} = options;
|
|
1033
|
+
|
|
1034
|
+
// src/configs/unicorn.ts
|
|
1035
|
+
function unicorn() {
|
|
944
1036
|
return [
|
|
945
1037
|
{
|
|
946
|
-
files: [
|
|
947
|
-
GLOB_TS,
|
|
948
|
-
GLOB_TSX,
|
|
949
|
-
...componentExts.map((ext) => `**/*.${ext}`)
|
|
950
|
-
],
|
|
951
|
-
ignores: ["**/*.md/*.*"],
|
|
952
|
-
languageOptions: {
|
|
953
|
-
parser: default19,
|
|
954
|
-
parserOptions: {
|
|
955
|
-
project: [tsconfigPath],
|
|
956
|
-
tsconfigRootDir
|
|
957
|
-
}
|
|
958
|
-
},
|
|
959
1038
|
plugins: {
|
|
960
|
-
|
|
961
|
-
}
|
|
1039
|
+
unicorn: default11
|
|
1040
|
+
}
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
962
1043
|
rules: {
|
|
963
|
-
|
|
964
|
-
"
|
|
965
|
-
|
|
966
|
-
"
|
|
967
|
-
|
|
968
|
-
"
|
|
969
|
-
|
|
970
|
-
"
|
|
971
|
-
|
|
972
|
-
"
|
|
973
|
-
|
|
974
|
-
"
|
|
975
|
-
|
|
976
|
-
"
|
|
977
|
-
|
|
978
|
-
"
|
|
979
|
-
|
|
980
|
-
"
|
|
981
|
-
|
|
982
|
-
"
|
|
983
|
-
|
|
1044
|
+
// Pass error message when throwing errors
|
|
1045
|
+
"unicorn/error-message": "error",
|
|
1046
|
+
// Uppercase regex escapes
|
|
1047
|
+
"unicorn/escape-case": "error",
|
|
1048
|
+
// Array.isArray instead of instanceof
|
|
1049
|
+
"unicorn/no-instanceof-array": "error",
|
|
1050
|
+
// Ban `new Array` as `Array` constructor's params are ambiguous
|
|
1051
|
+
"unicorn/no-new-array": "error",
|
|
1052
|
+
// Prevent deprecated `new Buffer()`
|
|
1053
|
+
"unicorn/no-new-buffer": "error",
|
|
1054
|
+
// Keep regex literals safe!
|
|
1055
|
+
"unicorn/no-unsafe-regex": "error",
|
|
1056
|
+
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
1057
|
+
"unicorn/number-literal-case": "error",
|
|
1058
|
+
// includes over indexOf when checking for existence
|
|
1059
|
+
"unicorn/prefer-includes": "error",
|
|
1060
|
+
// Prefer using the node: protocol
|
|
1061
|
+
"unicorn/prefer-node-protocol": "error",
|
|
1062
|
+
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
1063
|
+
"unicorn/prefer-number-properties": "error",
|
|
1064
|
+
// String methods startsWith/endsWith instead of more complicated stuff
|
|
1065
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1066
|
+
// textContent instead of innerText
|
|
1067
|
+
"unicorn/prefer-text-content": "error",
|
|
1068
|
+
// Enforce throwing type error when throwing error while checking typeof
|
|
1069
|
+
"unicorn/prefer-type-error": "error",
|
|
1070
|
+
// Use new when throwing error
|
|
1071
|
+
"unicorn/throw-new-error": "error"
|
|
984
1072
|
}
|
|
985
1073
|
}
|
|
986
1074
|
];
|
|
987
1075
|
}
|
|
988
1076
|
|
|
989
|
-
// src/configs/unicorn.ts
|
|
990
|
-
var unicorn = [
|
|
991
|
-
{
|
|
992
|
-
plugins: {
|
|
993
|
-
unicorn: default12
|
|
994
|
-
},
|
|
995
|
-
rules: {
|
|
996
|
-
// Pass error message when throwing errors
|
|
997
|
-
"unicorn/error-message": "error",
|
|
998
|
-
// Uppercase regex escapes
|
|
999
|
-
"unicorn/escape-case": "error",
|
|
1000
|
-
// Array.isArray instead of instanceof
|
|
1001
|
-
"unicorn/no-instanceof-array": "error",
|
|
1002
|
-
// Ban `new Array` as `Array` constructor's params are ambiguous
|
|
1003
|
-
"unicorn/no-new-array": "error",
|
|
1004
|
-
// Prevent deprecated `new Buffer()`
|
|
1005
|
-
"unicorn/no-new-buffer": "error",
|
|
1006
|
-
// Keep regex literals safe!
|
|
1007
|
-
"unicorn/no-unsafe-regex": "error",
|
|
1008
|
-
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
1009
|
-
"unicorn/number-literal-case": "error",
|
|
1010
|
-
// includes over indexOf when checking for existence
|
|
1011
|
-
"unicorn/prefer-includes": "error",
|
|
1012
|
-
// Prefer using the node: protocol
|
|
1013
|
-
"unicorn/prefer-node-protocol": "error",
|
|
1014
|
-
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
1015
|
-
"unicorn/prefer-number-properties": "error",
|
|
1016
|
-
// String methods startsWith/endsWith instead of more complicated stuff
|
|
1017
|
-
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1018
|
-
// textContent instead of innerText
|
|
1019
|
-
"unicorn/prefer-text-content": "error",
|
|
1020
|
-
// Enforce throwing type error when throwing error while checking typeof
|
|
1021
|
-
"unicorn/prefer-type-error": "error",
|
|
1022
|
-
// Use new when throwing error
|
|
1023
|
-
"unicorn/throw-new-error": "error"
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
];
|
|
1027
|
-
|
|
1028
1077
|
// src/configs/vue.ts
|
|
1029
1078
|
import process2 from "process";
|
|
1030
1079
|
import { getPackageInfoSync } from "local-pkg";
|
|
@@ -1036,19 +1085,28 @@ function getVueVersion() {
|
|
|
1036
1085
|
}
|
|
1037
1086
|
var isVue3 = getVueVersion() === 3;
|
|
1038
1087
|
var vue3Rules = {
|
|
1039
|
-
...
|
|
1040
|
-
...
|
|
1041
|
-
...
|
|
1042
|
-
...
|
|
1088
|
+
...default13.configs.base.rules,
|
|
1089
|
+
...default13.configs["vue3-essential"].rules,
|
|
1090
|
+
...default13.configs["vue3-strongly-recommended"].rules,
|
|
1091
|
+
...default13.configs["vue3-recommended"].rules
|
|
1043
1092
|
};
|
|
1044
1093
|
var vue2Rules = {
|
|
1045
|
-
...
|
|
1046
|
-
...
|
|
1047
|
-
...
|
|
1048
|
-
...
|
|
1094
|
+
...default13.configs.base.rules,
|
|
1095
|
+
...default13.configs.essential.rules,
|
|
1096
|
+
...default13.configs["strongly-recommended"].rules,
|
|
1097
|
+
...default13.configs.recommended.rules
|
|
1049
1098
|
};
|
|
1050
1099
|
function vue(options = {}) {
|
|
1100
|
+
const {
|
|
1101
|
+
overrides = {},
|
|
1102
|
+
stylistic: stylistic2 = true
|
|
1103
|
+
} = options;
|
|
1051
1104
|
return [
|
|
1105
|
+
{
|
|
1106
|
+
plugins: {
|
|
1107
|
+
vue: default13
|
|
1108
|
+
}
|
|
1109
|
+
},
|
|
1052
1110
|
{
|
|
1053
1111
|
files: [GLOB_VUE],
|
|
1054
1112
|
languageOptions: {
|
|
@@ -1062,26 +1120,13 @@ function vue(options = {}) {
|
|
|
1062
1120
|
sourceType: "module"
|
|
1063
1121
|
}
|
|
1064
1122
|
},
|
|
1065
|
-
|
|
1066
|
-
vue: default14
|
|
1067
|
-
},
|
|
1068
|
-
processor: default14.processors[".vue"],
|
|
1123
|
+
processor: default13.processors[".vue"],
|
|
1069
1124
|
rules: {
|
|
1070
1125
|
...isVue3 ? vue3Rules : vue2Rules,
|
|
1071
|
-
"
|
|
1072
|
-
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1126
|
+
"node/prefer-global/process": OFF,
|
|
1073
1127
|
"vue/block-order": ["error", {
|
|
1074
1128
|
order: ["script", "template", "style"]
|
|
1075
1129
|
}],
|
|
1076
|
-
"vue/block-spacing": ["error", "always"],
|
|
1077
|
-
"vue/block-tag-newline": ["error", {
|
|
1078
|
-
multiline: "always",
|
|
1079
|
-
singleline: "always"
|
|
1080
|
-
}],
|
|
1081
|
-
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1082
|
-
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1083
|
-
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1084
|
-
"vue/comma-style": ["error", "last"],
|
|
1085
1130
|
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1086
1131
|
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1087
1132
|
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
@@ -1091,14 +1136,8 @@ function vue(options = {}) {
|
|
|
1091
1136
|
"vue/dot-location": ["error", "property"],
|
|
1092
1137
|
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1093
1138
|
"vue/eqeqeq": ["error", "smart"],
|
|
1094
|
-
"vue/html-comment-content-spacing": ["error", "always", {
|
|
1095
|
-
exceptions: ["-"]
|
|
1096
|
-
}],
|
|
1097
|
-
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1098
|
-
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1099
1139
|
"vue/max-attributes-per-line": OFF,
|
|
1100
1140
|
"vue/multi-word-component-names": OFF,
|
|
1101
|
-
"vue/no-constant-condition": "warn",
|
|
1102
1141
|
"vue/no-dupe-keys": OFF,
|
|
1103
1142
|
"vue/no-empty-pattern": "error",
|
|
1104
1143
|
"vue/no-extra-parens": ["error", "functions"],
|
|
@@ -1111,16 +1150,11 @@ function vue(options = {}) {
|
|
|
1111
1150
|
"WithStatement"
|
|
1112
1151
|
],
|
|
1113
1152
|
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
1114
|
-
// reactivity transform
|
|
1115
1153
|
"vue/no-setup-props-reactivity-loss": OFF,
|
|
1116
1154
|
"vue/no-sparse-arrays": "error",
|
|
1117
1155
|
"vue/no-unused-refs": "error",
|
|
1118
1156
|
"vue/no-useless-v-bind": "error",
|
|
1119
1157
|
"vue/no-v-html": OFF,
|
|
1120
|
-
"vue/no-v-text-v-html-on-component": OFF,
|
|
1121
|
-
"vue/object-curly-newline": OFF,
|
|
1122
|
-
"vue/object-curly-spacing": ["error", "always"],
|
|
1123
|
-
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1124
1158
|
"vue/object-shorthand": [
|
|
1125
1159
|
"error",
|
|
1126
1160
|
"always",
|
|
@@ -1129,145 +1163,318 @@ function vue(options = {}) {
|
|
|
1129
1163
|
ignoreConstructors: false
|
|
1130
1164
|
}
|
|
1131
1165
|
],
|
|
1132
|
-
"vue/operator-linebreak": ["error", "before"],
|
|
1133
|
-
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1134
1166
|
"vue/prefer-separate-static-class": "error",
|
|
1135
1167
|
"vue/prefer-template": "error",
|
|
1136
|
-
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1137
1168
|
"vue/require-default-prop": OFF,
|
|
1138
1169
|
"vue/require-prop-types": OFF,
|
|
1139
|
-
"vue/space-in-parens": ["error", "never"],
|
|
1140
1170
|
"vue/space-infix-ops": "error",
|
|
1141
1171
|
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
1142
|
-
|
|
1172
|
+
...stylistic2 ? {
|
|
1173
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
1174
|
+
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1175
|
+
"vue/block-spacing": ["error", "always"],
|
|
1176
|
+
"vue/block-tag-newline": ["error", {
|
|
1177
|
+
multiline: "always",
|
|
1178
|
+
singleline: "always"
|
|
1179
|
+
}],
|
|
1180
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1181
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1182
|
+
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1183
|
+
"vue/comma-style": ["error", "last"],
|
|
1184
|
+
"vue/html-comment-content-spacing": ["error", "always", {
|
|
1185
|
+
exceptions: ["-"]
|
|
1186
|
+
}],
|
|
1187
|
+
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1188
|
+
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1189
|
+
"vue/object-curly-newline": OFF,
|
|
1190
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
1191
|
+
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1192
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
1193
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1194
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1195
|
+
"vue/space-in-parens": ["error", "never"],
|
|
1196
|
+
"vue/template-curly-spacing": "error"
|
|
1197
|
+
} : {},
|
|
1198
|
+
...overrides
|
|
1143
1199
|
}
|
|
1144
1200
|
}
|
|
1145
1201
|
];
|
|
1146
1202
|
}
|
|
1147
1203
|
|
|
1148
|
-
// src/configs/
|
|
1149
|
-
|
|
1150
|
-
{
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
},
|
|
1155
|
-
plugins: {
|
|
1156
|
-
yml: default15
|
|
1157
|
-
},
|
|
1158
|
-
rules: {
|
|
1159
|
-
...default15.configs.standard.rules,
|
|
1160
|
-
"style/spaced-comment": OFF,
|
|
1161
|
-
"yml/no-empty-document": OFF,
|
|
1162
|
-
"yml/no-empty-mapping-value": OFF,
|
|
1163
|
-
"yml/quotes": ["error", { avoidEscape: false, prefer: "single" }]
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
];
|
|
1167
|
-
|
|
1168
|
-
// src/configs/test.ts
|
|
1169
|
-
function test(options = {}) {
|
|
1204
|
+
// src/configs/yaml.ts
|
|
1205
|
+
function yaml(options = {}) {
|
|
1206
|
+
const {
|
|
1207
|
+
overrides = {},
|
|
1208
|
+
stylistic: stylistic2 = true
|
|
1209
|
+
} = options;
|
|
1170
1210
|
return [
|
|
1171
1211
|
{
|
|
1172
|
-
files: GLOB_TESTS,
|
|
1173
1212
|
plugins: {
|
|
1174
|
-
|
|
1213
|
+
yaml: default14
|
|
1214
|
+
}
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
files: [GLOB_YAML],
|
|
1218
|
+
languageOptions: {
|
|
1219
|
+
parser: default21
|
|
1175
1220
|
},
|
|
1176
1221
|
rules: {
|
|
1177
|
-
"
|
|
1222
|
+
"style/spaced-comment": OFF,
|
|
1223
|
+
"yaml/block-mapping": "error",
|
|
1224
|
+
"yaml/block-sequence": "error",
|
|
1225
|
+
"yaml/no-empty-key": "error",
|
|
1226
|
+
"yaml/no-empty-sequence-entry": "error",
|
|
1227
|
+
"yaml/no-irregular-whitespace": "error",
|
|
1228
|
+
"yaml/plain-scalar": "error",
|
|
1229
|
+
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
1230
|
+
...stylistic2 ? {
|
|
1231
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
1232
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
1233
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
1234
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
1235
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
1236
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
1237
|
+
"yaml/indent": ["error", 2],
|
|
1238
|
+
"yaml/key-spacing": "error",
|
|
1239
|
+
"yaml/no-tab-indent": "error",
|
|
1240
|
+
"yaml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
|
|
1241
|
+
"yaml/spaced-comment": "error"
|
|
1242
|
+
} : {},
|
|
1243
|
+
...overrides
|
|
1178
1244
|
}
|
|
1179
1245
|
}
|
|
1180
1246
|
];
|
|
1181
1247
|
}
|
|
1182
1248
|
|
|
1249
|
+
// src/configs/test.ts
|
|
1250
|
+
function test(options = {}) {
|
|
1251
|
+
const {
|
|
1252
|
+
isInEditor = false,
|
|
1253
|
+
overrides = {}
|
|
1254
|
+
} = options;
|
|
1255
|
+
return [{
|
|
1256
|
+
plugins: {
|
|
1257
|
+
"no-only-tests": default15
|
|
1258
|
+
}
|
|
1259
|
+
}, {
|
|
1260
|
+
files: GLOB_TESTS,
|
|
1261
|
+
rules: {
|
|
1262
|
+
"no-only-tests/no-only-tests": isInEditor ? OFF : "error",
|
|
1263
|
+
...overrides
|
|
1264
|
+
}
|
|
1265
|
+
}];
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1183
1268
|
// src/configs/react.ts
|
|
1184
1269
|
function react(options = {}) {
|
|
1270
|
+
const {
|
|
1271
|
+
overrides = {}
|
|
1272
|
+
} = options;
|
|
1185
1273
|
return [
|
|
1274
|
+
{
|
|
1275
|
+
plugins: {
|
|
1276
|
+
"react": default16,
|
|
1277
|
+
"react-hooks": default17
|
|
1278
|
+
}
|
|
1279
|
+
},
|
|
1186
1280
|
{
|
|
1187
1281
|
files: [GLOB_JSX, GLOB_TSX],
|
|
1188
1282
|
languageOptions: {
|
|
1189
|
-
parser: options.typescript ? default19 : null,
|
|
1190
1283
|
parserOptions: {
|
|
1284
|
+
ecmaFeatures: {
|
|
1285
|
+
jsx: true
|
|
1286
|
+
},
|
|
1287
|
+
parser: options.typescript ? default19 : null,
|
|
1191
1288
|
sourceType: "module"
|
|
1192
1289
|
}
|
|
1193
1290
|
},
|
|
1194
|
-
|
|
1195
|
-
"
|
|
1196
|
-
|
|
1291
|
+
rules: {
|
|
1292
|
+
"jsx-quotes": ["error", "prefer-double"],
|
|
1293
|
+
...default16.configs.recommended.rules,
|
|
1294
|
+
"react/react-in-jsx-scope": OFF,
|
|
1295
|
+
...default17.configs.recommended.rules,
|
|
1296
|
+
...overrides
|
|
1197
1297
|
},
|
|
1198
1298
|
settings: {
|
|
1199
1299
|
react: {
|
|
1200
1300
|
version: "detect"
|
|
1201
1301
|
}
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
];
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
// src/configs/astro.ts
|
|
1308
|
+
function astro(options = {}) {
|
|
1309
|
+
const { overrides = {} } = options;
|
|
1310
|
+
return [
|
|
1311
|
+
{
|
|
1312
|
+
plugins: {
|
|
1313
|
+
astro: default18
|
|
1314
|
+
}
|
|
1315
|
+
},
|
|
1316
|
+
{
|
|
1317
|
+
files: [GLOB_ASTRO],
|
|
1318
|
+
languageOptions: {
|
|
1319
|
+
parser: default23,
|
|
1320
|
+
parserOptions: {
|
|
1321
|
+
extraFileExtensions: [".astro"],
|
|
1322
|
+
parser: options.typescript ? default19 : null
|
|
1323
|
+
}
|
|
1202
1324
|
},
|
|
1203
1325
|
rules: {
|
|
1204
|
-
|
|
1205
|
-
...
|
|
1206
|
-
"react/react-in-jsx-scope": "off",
|
|
1207
|
-
...default18.configs.recommended.rules
|
|
1326
|
+
...default18.configs.recommended.rules,
|
|
1327
|
+
...overrides
|
|
1208
1328
|
}
|
|
1209
1329
|
}
|
|
1210
1330
|
];
|
|
1211
1331
|
}
|
|
1212
1332
|
|
|
1213
1333
|
// src/factory.ts
|
|
1334
|
+
var flatConfigProps = [
|
|
1335
|
+
"files",
|
|
1336
|
+
"ignores",
|
|
1337
|
+
"languageOptions",
|
|
1338
|
+
"linterOptions",
|
|
1339
|
+
"processor",
|
|
1340
|
+
"plugins",
|
|
1341
|
+
"rules",
|
|
1342
|
+
"settings"
|
|
1343
|
+
];
|
|
1344
|
+
var VuePackages = [
|
|
1345
|
+
"vue",
|
|
1346
|
+
"nuxt",
|
|
1347
|
+
"vitepress",
|
|
1348
|
+
"@slidev/cli"
|
|
1349
|
+
];
|
|
1350
|
+
var ReactPackages = [
|
|
1351
|
+
"react",
|
|
1352
|
+
"next"
|
|
1353
|
+
];
|
|
1354
|
+
var AstroPackages = [
|
|
1355
|
+
"astro"
|
|
1356
|
+
];
|
|
1214
1357
|
function coderwyd(options = {}, ...userConfigs) {
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1358
|
+
const {
|
|
1359
|
+
isInEditor = !!((process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE) && !process3.env.CI),
|
|
1360
|
+
vue: enableVue = VuePackages.some((i) => isPackageExists(i)),
|
|
1361
|
+
react: enableReact = ReactPackages.some((i) => isPackageExists(i)),
|
|
1362
|
+
astro: enableAstro = AstroPackages.some((i) => isPackageExists(i)),
|
|
1363
|
+
typescript: enableTypeScript = isPackageExists("typescript"),
|
|
1364
|
+
stylistic: enableStylistic = true,
|
|
1365
|
+
gitignore: enableGitignore = true,
|
|
1366
|
+
overrides = {},
|
|
1367
|
+
componentExts = []
|
|
1368
|
+
} = options;
|
|
1369
|
+
const configs = [];
|
|
1370
|
+
if (enableGitignore) {
|
|
1371
|
+
if (typeof enableGitignore !== "boolean") {
|
|
1372
|
+
configs.push([gitignore(enableGitignore)]);
|
|
1373
|
+
} else {
|
|
1374
|
+
if (fs.existsSync(".gitignore"))
|
|
1375
|
+
configs.push([gitignore()]);
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
configs.push(
|
|
1379
|
+
ignores(),
|
|
1222
1380
|
javascript({ isInEditor }),
|
|
1223
|
-
comments,
|
|
1224
|
-
node,
|
|
1225
|
-
jsdoc
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1381
|
+
comments(),
|
|
1382
|
+
node(),
|
|
1383
|
+
jsdoc({
|
|
1384
|
+
stylistic: enableStylistic
|
|
1385
|
+
}),
|
|
1386
|
+
imports({
|
|
1387
|
+
stylistic: enableStylistic
|
|
1388
|
+
}),
|
|
1389
|
+
unicorn()
|
|
1390
|
+
);
|
|
1230
1391
|
if (enableVue)
|
|
1231
1392
|
componentExts.push("vue");
|
|
1232
|
-
if (enableStylistic)
|
|
1233
|
-
configs.push(javascriptStylistic);
|
|
1234
1393
|
if (enableTypeScript) {
|
|
1235
|
-
configs.push(typescript({
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
}));
|
|
1241
|
-
}
|
|
1242
|
-
if (enableStylistic)
|
|
1243
|
-
configs.push(typescriptStylistic);
|
|
1394
|
+
configs.push(typescript({
|
|
1395
|
+
...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
|
|
1396
|
+
componentExts,
|
|
1397
|
+
overrides: overrides.typescript
|
|
1398
|
+
}));
|
|
1244
1399
|
}
|
|
1400
|
+
if (enableStylistic)
|
|
1401
|
+
configs.push(stylistic());
|
|
1245
1402
|
if (options.test ?? true)
|
|
1246
|
-
configs.push(test({ isInEditor }));
|
|
1247
|
-
if (enableVue)
|
|
1248
|
-
configs.push(vue({
|
|
1249
|
-
|
|
1250
|
-
|
|
1403
|
+
configs.push(test({ isInEditor, overrides: overrides.test }));
|
|
1404
|
+
if (enableVue) {
|
|
1405
|
+
configs.push(vue({
|
|
1406
|
+
overrides: overrides.vue,
|
|
1407
|
+
stylistic: enableStylistic,
|
|
1408
|
+
typescript: !!enableTypeScript
|
|
1409
|
+
}));
|
|
1410
|
+
}
|
|
1411
|
+
if (enableReact) {
|
|
1412
|
+
configs.push(react({
|
|
1413
|
+
overrides: overrides.react,
|
|
1414
|
+
typescript: !!enableTypeScript
|
|
1415
|
+
}));
|
|
1416
|
+
}
|
|
1417
|
+
if (enableAstro) {
|
|
1418
|
+
configs.push(astro({
|
|
1419
|
+
overrides: overrides.astro,
|
|
1420
|
+
typescript: !!enableTypeScript
|
|
1421
|
+
}));
|
|
1422
|
+
}
|
|
1251
1423
|
if (options.jsonc ?? true) {
|
|
1252
1424
|
configs.push(
|
|
1253
|
-
jsonc,
|
|
1254
|
-
sortPackageJson,
|
|
1255
|
-
sortTsconfig
|
|
1425
|
+
jsonc(),
|
|
1426
|
+
sortPackageJson(),
|
|
1427
|
+
sortTsconfig()
|
|
1256
1428
|
);
|
|
1257
1429
|
}
|
|
1258
|
-
if (options.yaml ?? true)
|
|
1259
|
-
configs.push(
|
|
1430
|
+
if (options.yaml ?? true) {
|
|
1431
|
+
configs.push(yaml({
|
|
1432
|
+
overrides: overrides.yaml,
|
|
1433
|
+
stylistic: enableStylistic
|
|
1434
|
+
}));
|
|
1435
|
+
}
|
|
1260
1436
|
if (options.markdown ?? true)
|
|
1261
|
-
configs.push(markdown({ componentExts }));
|
|
1262
|
-
|
|
1437
|
+
configs.push(markdown({ componentExts, overrides: overrides.markdown }));
|
|
1438
|
+
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
1439
|
+
if (key in options)
|
|
1440
|
+
acc[key] = options[key];
|
|
1441
|
+
return acc;
|
|
1442
|
+
}, {});
|
|
1443
|
+
if (Object.keys(fusedConfig).length)
|
|
1444
|
+
configs.push([fusedConfig]);
|
|
1445
|
+
const merged = combine(
|
|
1263
1446
|
...configs,
|
|
1264
1447
|
...userConfigs
|
|
1265
1448
|
);
|
|
1449
|
+
return merged;
|
|
1266
1450
|
}
|
|
1267
1451
|
|
|
1268
1452
|
// src/index.ts
|
|
1269
1453
|
var src_default = coderwyd;
|
|
1270
1454
|
export {
|
|
1455
|
+
GLOB_ALL_SRC,
|
|
1456
|
+
GLOB_ASTRO,
|
|
1457
|
+
GLOB_CSS,
|
|
1458
|
+
GLOB_EXCLUDE,
|
|
1459
|
+
GLOB_HTML,
|
|
1460
|
+
GLOB_JS,
|
|
1461
|
+
GLOB_JSON,
|
|
1462
|
+
GLOB_JSON5,
|
|
1463
|
+
GLOB_JSONC,
|
|
1464
|
+
GLOB_JSX,
|
|
1465
|
+
GLOB_LESS,
|
|
1466
|
+
GLOB_MARKDOWN,
|
|
1467
|
+
GLOB_MARKDOWN_CODE,
|
|
1468
|
+
GLOB_SCSS,
|
|
1469
|
+
GLOB_SRC,
|
|
1470
|
+
GLOB_SRC_EXT,
|
|
1471
|
+
GLOB_STYLE,
|
|
1472
|
+
GLOB_TESTS,
|
|
1473
|
+
GLOB_TS,
|
|
1474
|
+
GLOB_TSX,
|
|
1475
|
+
GLOB_VUE,
|
|
1476
|
+
GLOB_YAML,
|
|
1477
|
+
astro,
|
|
1271
1478
|
coderwyd,
|
|
1272
1479
|
combine,
|
|
1273
1480
|
comments,
|
|
@@ -1276,41 +1483,40 @@ export {
|
|
|
1276
1483
|
ignores,
|
|
1277
1484
|
imports,
|
|
1278
1485
|
javascript,
|
|
1279
|
-
javascriptStylistic,
|
|
1280
1486
|
jsdoc,
|
|
1281
1487
|
jsonc,
|
|
1282
1488
|
markdown,
|
|
1283
1489
|
node,
|
|
1490
|
+
default23 as parserAstro,
|
|
1284
1491
|
default22 as parserJsonc,
|
|
1285
1492
|
default19 as parserTs,
|
|
1286
1493
|
default20 as parserVue,
|
|
1287
|
-
default21 as
|
|
1494
|
+
default21 as parserYaml,
|
|
1288
1495
|
default2 as pluginAntfu,
|
|
1496
|
+
default18 as pluginAstro,
|
|
1289
1497
|
default3 as pluginComments,
|
|
1290
1498
|
default4 as pluginImport,
|
|
1291
1499
|
default5 as pluginJsdoc,
|
|
1292
1500
|
default6 as pluginJsonc,
|
|
1293
1501
|
default7 as pluginMarkdown,
|
|
1294
|
-
|
|
1502
|
+
default15 as pluginNoOnlyTests,
|
|
1295
1503
|
default8 as pluginNode,
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
default9 as
|
|
1299
|
-
default10 as
|
|
1300
|
-
default11 as
|
|
1301
|
-
default12 as
|
|
1302
|
-
default13 as
|
|
1303
|
-
default14 as
|
|
1304
|
-
default15 as pluginYml,
|
|
1504
|
+
default16 as pluginReact,
|
|
1505
|
+
default17 as pluginReactHooks,
|
|
1506
|
+
default9 as pluginStylistic,
|
|
1507
|
+
default10 as pluginTs,
|
|
1508
|
+
default11 as pluginUnicorn,
|
|
1509
|
+
default12 as pluginUnusedImports,
|
|
1510
|
+
default13 as pluginVue,
|
|
1511
|
+
default14 as pluginYaml,
|
|
1305
1512
|
react,
|
|
1306
1513
|
renameRules,
|
|
1307
1514
|
sortPackageJson,
|
|
1308
1515
|
sortTsconfig,
|
|
1516
|
+
stylistic,
|
|
1309
1517
|
test,
|
|
1310
1518
|
typescript,
|
|
1311
|
-
typescriptStylistic,
|
|
1312
|
-
typescriptWithLanguageServer,
|
|
1313
1519
|
unicorn,
|
|
1314
1520
|
vue,
|
|
1315
|
-
|
|
1521
|
+
yaml
|
|
1316
1522
|
};
|