@coderwyd/eslint-config 1.1.0-beta.1 → 1.1.0-beta.3
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 +260 -51
- package/dist/index.cjs +1070 -683
- package/dist/index.d.cts +152 -33
- package/dist/index.d.ts +152 -33
- package/dist/index.js +1080 -715
- package/package.json +23 -12
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,
|
|
@@ -45,15 +67,15 @@ __export(src_exports, {
|
|
|
45
67
|
node: () => node,
|
|
46
68
|
parserAstro: () => import_astro_eslint_parser.default,
|
|
47
69
|
parserJsonc: () => import_jsonc_eslint_parser.default,
|
|
48
|
-
parserTs: () =>
|
|
70
|
+
parserTs: () => parserTs,
|
|
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,
|
|
54
|
-
pluginImport: () =>
|
|
76
|
+
pluginImport: () => pluginImport,
|
|
55
77
|
pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
|
|
56
|
-
pluginJsonc: () =>
|
|
78
|
+
pluginJsonc: () => pluginJsonc,
|
|
57
79
|
pluginMarkdown: () => import_eslint_plugin_markdown.default,
|
|
58
80
|
pluginNoOnlyTests: () => import_eslint_plugin_no_only_tests.default,
|
|
59
81
|
pluginNode: () => import_eslint_plugin_n.default,
|
|
@@ -63,8 +85,9 @@ __export(src_exports, {
|
|
|
63
85
|
pluginTs: () => import_eslint_plugin2.default,
|
|
64
86
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
65
87
|
pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
|
|
88
|
+
pluginVitest: () => import_eslint_plugin_vitest.default,
|
|
66
89
|
pluginVue: () => import_eslint_plugin_vue.default,
|
|
67
|
-
|
|
90
|
+
pluginYaml: () => pluginYaml,
|
|
68
91
|
react: () => react,
|
|
69
92
|
renameRules: () => renameRules,
|
|
70
93
|
sortPackageJson: () => sortPackageJson,
|
|
@@ -72,10 +95,9 @@ __export(src_exports, {
|
|
|
72
95
|
stylistic: () => stylistic,
|
|
73
96
|
test: () => test,
|
|
74
97
|
typescript: () => typescript,
|
|
75
|
-
typescriptWithLanguageServer: () => typescriptWithLanguageServer,
|
|
76
98
|
unicorn: () => unicorn,
|
|
77
99
|
vue: () => vue,
|
|
78
|
-
|
|
100
|
+
yaml: () => yaml
|
|
79
101
|
});
|
|
80
102
|
module.exports = __toCommonJS(src_exports);
|
|
81
103
|
|
|
@@ -88,60 +110,82 @@ var import_eslint_config_flat_gitignore = __toESM(require("eslint-config-flat-gi
|
|
|
88
110
|
// src/plugins.ts
|
|
89
111
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
90
112
|
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
91
|
-
var
|
|
113
|
+
var pluginImport = __toESM(require("eslint-plugin-i"), 1);
|
|
92
114
|
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
93
|
-
var
|
|
115
|
+
var pluginJsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
94
116
|
var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
|
|
95
117
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
96
118
|
var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
|
|
97
119
|
var import_eslint_plugin2 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
98
120
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
99
121
|
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
100
|
-
var
|
|
101
|
-
var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
|
|
122
|
+
var pluginYaml = __toESM(require("eslint-plugin-yml"), 1);
|
|
102
123
|
var import_eslint_plugin_no_only_tests = __toESM(require("eslint-plugin-no-only-tests"), 1);
|
|
124
|
+
var import_eslint_plugin_vitest = __toESM(require("eslint-plugin-vitest"), 1);
|
|
125
|
+
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
103
126
|
var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
|
|
104
127
|
var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
|
|
105
128
|
var import_eslint_plugin_astro = __toESM(require("eslint-plugin-astro"), 1);
|
|
106
|
-
var
|
|
129
|
+
var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
|
|
107
130
|
var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
|
|
108
131
|
var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
|
|
109
132
|
var import_jsonc_eslint_parser = __toESM(require("jsonc-eslint-parser"), 1);
|
|
110
133
|
var import_astro_eslint_parser = __toESM(require("astro-eslint-parser"), 1);
|
|
111
134
|
|
|
112
135
|
// src/configs/comments.ts
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
"eslint-comments"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
136
|
+
function comments() {
|
|
137
|
+
return [
|
|
138
|
+
{
|
|
139
|
+
name: "coderwyd:eslint-comments",
|
|
140
|
+
plugins: {
|
|
141
|
+
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
142
|
+
},
|
|
143
|
+
rules: {
|
|
144
|
+
"eslint-comments/no-aggregating-enable": "error",
|
|
145
|
+
"eslint-comments/no-duplicate-disable": "error",
|
|
146
|
+
"eslint-comments/no-unlimited-disable": "error",
|
|
147
|
+
"eslint-comments/no-unused-enable": "error"
|
|
148
|
+
}
|
|
123
149
|
}
|
|
124
|
-
|
|
125
|
-
|
|
150
|
+
];
|
|
151
|
+
}
|
|
126
152
|
|
|
127
153
|
// src/globs.ts
|
|
128
154
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
129
155
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
156
|
+
var GLOB_JS = "**/*.?([cm])js";
|
|
130
157
|
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
131
158
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
132
159
|
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
160
|
+
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
161
|
+
var GLOB_CSS = "**/*.css";
|
|
162
|
+
var GLOB_LESS = "**/*.less";
|
|
163
|
+
var GLOB_SCSS = "**/*.scss";
|
|
133
164
|
var GLOB_JSON = "**/*.json";
|
|
134
165
|
var GLOB_JSON5 = "**/*.json5";
|
|
135
166
|
var GLOB_JSONC = "**/*.jsonc";
|
|
136
167
|
var GLOB_MARKDOWN = "**/*.md";
|
|
137
168
|
var GLOB_VUE = "**/*.vue";
|
|
138
169
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
170
|
+
var GLOB_HTML = "**/*.htm?(l)";
|
|
139
171
|
var GLOB_ASTRO = "**/*.astro";
|
|
140
172
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
141
173
|
var GLOB_TESTS = [
|
|
142
174
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
143
175
|
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
144
|
-
`**/*.test.${GLOB_SRC_EXT}
|
|
176
|
+
`**/*.test.${GLOB_SRC_EXT}`,
|
|
177
|
+
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
178
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
179
|
+
];
|
|
180
|
+
var GLOB_ALL_SRC = [
|
|
181
|
+
GLOB_SRC,
|
|
182
|
+
GLOB_STYLE,
|
|
183
|
+
GLOB_JSON,
|
|
184
|
+
GLOB_JSON5,
|
|
185
|
+
GLOB_MARKDOWN,
|
|
186
|
+
GLOB_VUE,
|
|
187
|
+
GLOB_YAML,
|
|
188
|
+
GLOB_HTML
|
|
145
189
|
];
|
|
146
190
|
var GLOB_EXCLUDE = [
|
|
147
191
|
"**/node_modules",
|
|
@@ -149,6 +193,7 @@ var GLOB_EXCLUDE = [
|
|
|
149
193
|
"**/package-lock.json",
|
|
150
194
|
"**/yarn.lock",
|
|
151
195
|
"**/pnpm-lock.yaml",
|
|
196
|
+
"**/bun.lockb",
|
|
152
197
|
"**/output",
|
|
153
198
|
"**/coverage",
|
|
154
199
|
"**/temp",
|
|
@@ -157,6 +202,7 @@ var GLOB_EXCLUDE = [
|
|
|
157
202
|
"**/.vercel",
|
|
158
203
|
"**/.changeset",
|
|
159
204
|
"**/.idea",
|
|
205
|
+
"**/.cache",
|
|
160
206
|
"**/.output",
|
|
161
207
|
"**/.vite-inspect",
|
|
162
208
|
"**/CHANGELOG*.md",
|
|
@@ -168,29 +214,43 @@ var GLOB_EXCLUDE = [
|
|
|
168
214
|
];
|
|
169
215
|
|
|
170
216
|
// src/configs/ignores.ts
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
217
|
+
function ignores() {
|
|
218
|
+
return [
|
|
219
|
+
{
|
|
220
|
+
ignores: GLOB_EXCLUDE
|
|
221
|
+
}
|
|
222
|
+
];
|
|
223
|
+
}
|
|
174
224
|
|
|
175
225
|
// src/configs/imports.ts
|
|
176
|
-
|
|
177
|
-
{
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
226
|
+
function imports(options = {}) {
|
|
227
|
+
const {
|
|
228
|
+
stylistic: stylistic2 = true
|
|
229
|
+
} = options;
|
|
230
|
+
return [
|
|
231
|
+
{
|
|
232
|
+
name: "coderwyd:imports",
|
|
233
|
+
plugins: {
|
|
234
|
+
antfu: import_eslint_plugin_antfu.default,
|
|
235
|
+
import: pluginImport
|
|
236
|
+
},
|
|
237
|
+
rules: {
|
|
238
|
+
"antfu/import-dedupe": "error",
|
|
239
|
+
"antfu/no-import-node-modules-by-path": "error",
|
|
240
|
+
"import/first": "error",
|
|
241
|
+
"import/no-duplicates": "error",
|
|
242
|
+
"import/no-mutable-exports": "error",
|
|
243
|
+
"import/no-named-default": "error",
|
|
244
|
+
"import/no-self-import": "error",
|
|
245
|
+
"import/no-webpack-loader-syntax": "error",
|
|
246
|
+
"import/order": "error",
|
|
247
|
+
...stylistic2 ? {
|
|
248
|
+
"import/newline-after-import": ["error", { considerComments: true, count: 1 }]
|
|
249
|
+
} : {}
|
|
250
|
+
}
|
|
191
251
|
}
|
|
192
|
-
|
|
193
|
-
|
|
252
|
+
];
|
|
253
|
+
}
|
|
194
254
|
|
|
195
255
|
// src/configs/javascript.ts
|
|
196
256
|
var import_globals = __toESM(require("globals"), 1);
|
|
@@ -200,6 +260,10 @@ var OFF = 0;
|
|
|
200
260
|
|
|
201
261
|
// src/configs/javascript.ts
|
|
202
262
|
function javascript(options = {}) {
|
|
263
|
+
const {
|
|
264
|
+
isInEditor = false,
|
|
265
|
+
overrides = {}
|
|
266
|
+
} = options;
|
|
203
267
|
return [
|
|
204
268
|
{
|
|
205
269
|
languageOptions: {
|
|
@@ -221,26 +285,21 @@ function javascript(options = {}) {
|
|
|
221
285
|
},
|
|
222
286
|
sourceType: "module"
|
|
223
287
|
},
|
|
288
|
+
name: "coderwyd:javascript",
|
|
224
289
|
plugins: {
|
|
225
290
|
"antfu": import_eslint_plugin_antfu.default,
|
|
226
291
|
"unused-imports": import_eslint_plugin_unused_imports.default
|
|
227
292
|
},
|
|
228
293
|
rules: {
|
|
229
294
|
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
230
|
-
"antfu/import-dedupe": "error",
|
|
231
|
-
"antfu/no-import-node-modules-by-path": "error",
|
|
232
|
-
"antfu/top-level-function": "error",
|
|
233
295
|
"array-callback-return": "error",
|
|
234
296
|
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
235
297
|
"block-scoped-var": "error",
|
|
236
298
|
"constructor-super": "error",
|
|
237
299
|
"default-case-last": "error",
|
|
238
300
|
"dot-notation": ["error", { allowKeywords: true }],
|
|
239
|
-
"eol-last": "error",
|
|
240
301
|
"eqeqeq": ["error", "smart"],
|
|
241
|
-
"max-statements-per-line": ["error", { max: 1 }],
|
|
242
302
|
"new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
|
|
243
|
-
"new-parens": "error",
|
|
244
303
|
"no-alert": "error",
|
|
245
304
|
"no-array-constructor": "error",
|
|
246
305
|
"no-async-promise-executor": "error",
|
|
@@ -251,7 +310,6 @@ function javascript(options = {}) {
|
|
|
251
310
|
"no-cond-assign": ["error", "always"],
|
|
252
311
|
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
253
312
|
"no-const-assign": "error",
|
|
254
|
-
"no-constant-condition": "warn",
|
|
255
313
|
"no-control-regex": "error",
|
|
256
314
|
"no-debugger": "error",
|
|
257
315
|
"no-delete-var": "error",
|
|
@@ -267,9 +325,7 @@ function javascript(options = {}) {
|
|
|
267
325
|
"no-extend-native": "error",
|
|
268
326
|
"no-extra-bind": "error",
|
|
269
327
|
"no-extra-boolean-cast": "error",
|
|
270
|
-
"no-extra-parens": ["error", "functions"],
|
|
271
328
|
"no-fallthrough": "error",
|
|
272
|
-
"no-floating-decimal": "error",
|
|
273
329
|
"no-func-assign": "error",
|
|
274
330
|
"no-global-assign": "error",
|
|
275
331
|
"no-implied-eval": "error",
|
|
@@ -282,14 +338,6 @@ function javascript(options = {}) {
|
|
|
282
338
|
"no-lone-blocks": "error",
|
|
283
339
|
"no-loss-of-precision": "error",
|
|
284
340
|
"no-misleading-character-class": "error",
|
|
285
|
-
"no-mixed-operators": ["error", {
|
|
286
|
-
allowSamePrecedence: true,
|
|
287
|
-
groups: [
|
|
288
|
-
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
|
289
|
-
["&&", "||"],
|
|
290
|
-
["in", "instanceof"]
|
|
291
|
-
]
|
|
292
|
-
}],
|
|
293
341
|
"no-multi-str": "error",
|
|
294
342
|
"no-new": "error",
|
|
295
343
|
"no-new-func": "error",
|
|
@@ -320,7 +368,9 @@ function javascript(options = {}) {
|
|
|
320
368
|
"error",
|
|
321
369
|
"DebuggerStatement",
|
|
322
370
|
"LabeledStatement",
|
|
323
|
-
"WithStatement"
|
|
371
|
+
"WithStatement",
|
|
372
|
+
"TSEnumDeclaration[const=true]",
|
|
373
|
+
"TSExportAssignment"
|
|
324
374
|
],
|
|
325
375
|
"no-self-assign": ["error", { props: true }],
|
|
326
376
|
"no-self-compare": "error",
|
|
@@ -390,7 +440,6 @@ function javascript(options = {}) {
|
|
|
390
440
|
"prefer-rest-params": "error",
|
|
391
441
|
"prefer-spread": "error",
|
|
392
442
|
"prefer-template": "error",
|
|
393
|
-
"quote-props": ["error", "consistent-as-needed"],
|
|
394
443
|
"sort-imports": [
|
|
395
444
|
"error",
|
|
396
445
|
{
|
|
@@ -403,7 +452,7 @@ function javascript(options = {}) {
|
|
|
403
452
|
],
|
|
404
453
|
"symbol-description": "error",
|
|
405
454
|
"unicode-bom": ["error", "never"],
|
|
406
|
-
"unused-imports/no-unused-imports":
|
|
455
|
+
"unused-imports/no-unused-imports": isInEditor ? OFF : "error",
|
|
407
456
|
"unused-imports/no-unused-vars": [
|
|
408
457
|
"error",
|
|
409
458
|
{ args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^_" }
|
|
@@ -411,12 +460,13 @@ function javascript(options = {}) {
|
|
|
411
460
|
"use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
|
|
412
461
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
413
462
|
"vars-on-top": "error",
|
|
414
|
-
"
|
|
415
|
-
|
|
463
|
+
"yoda": ["error", "never"],
|
|
464
|
+
...overrides
|
|
416
465
|
}
|
|
417
466
|
},
|
|
418
467
|
{
|
|
419
468
|
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
469
|
+
name: "coderwyd:scripts-overrides",
|
|
420
470
|
rules: {
|
|
421
471
|
"no-console": OFF
|
|
422
472
|
}
|
|
@@ -425,97 +475,124 @@ function javascript(options = {}) {
|
|
|
425
475
|
}
|
|
426
476
|
|
|
427
477
|
// src/configs/jsdoc.ts
|
|
428
|
-
|
|
429
|
-
{
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
478
|
+
function jsdoc(options = {}) {
|
|
479
|
+
const {
|
|
480
|
+
stylistic: stylistic2 = true
|
|
481
|
+
} = options;
|
|
482
|
+
return [
|
|
483
|
+
{
|
|
484
|
+
name: "coderwyd:jsdoc",
|
|
485
|
+
plugins: {
|
|
486
|
+
jsdoc: import_eslint_plugin_jsdoc.default
|
|
487
|
+
},
|
|
488
|
+
rules: {
|
|
489
|
+
"jsdoc/check-access": "warn",
|
|
490
|
+
"jsdoc/check-param-names": "warn",
|
|
491
|
+
"jsdoc/check-property-names": "warn",
|
|
492
|
+
"jsdoc/check-types": "warn",
|
|
493
|
+
"jsdoc/empty-tags": "warn",
|
|
494
|
+
"jsdoc/implements-on-classes": "warn",
|
|
495
|
+
"jsdoc/no-defaults": "warn",
|
|
496
|
+
"jsdoc/no-multi-asterisks": "warn",
|
|
497
|
+
"jsdoc/require-param-name": "warn",
|
|
498
|
+
"jsdoc/require-property": "warn",
|
|
499
|
+
"jsdoc/require-property-description": "warn",
|
|
500
|
+
"jsdoc/require-property-name": "warn",
|
|
501
|
+
"jsdoc/require-returns-check": "warn",
|
|
502
|
+
"jsdoc/require-returns-description": "warn",
|
|
503
|
+
"jsdoc/require-yields-check": "warn",
|
|
504
|
+
...stylistic2 ? {
|
|
505
|
+
"jsdoc/check-alignment": "warn",
|
|
506
|
+
"jsdoc/multiline-blocks": "warn"
|
|
507
|
+
} : {}
|
|
508
|
+
}
|
|
453
509
|
}
|
|
454
|
-
|
|
455
|
-
|
|
510
|
+
];
|
|
511
|
+
}
|
|
456
512
|
|
|
457
513
|
// src/configs/jsonc.ts
|
|
458
|
-
|
|
459
|
-
{
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
514
|
+
function jsonc(options = {}) {
|
|
515
|
+
const {
|
|
516
|
+
stylistic: stylistic2 = true,
|
|
517
|
+
overrides = {}
|
|
518
|
+
} = options;
|
|
519
|
+
const {
|
|
520
|
+
indent = 2
|
|
521
|
+
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
522
|
+
return [
|
|
523
|
+
{
|
|
524
|
+
name: "coderwyd:jsonc:setup",
|
|
525
|
+
plugins: {
|
|
526
|
+
jsonc: pluginJsonc
|
|
527
|
+
}
|
|
466
528
|
},
|
|
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
|
-
|
|
529
|
+
{
|
|
530
|
+
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
531
|
+
languageOptions: {
|
|
532
|
+
parser: import_jsonc_eslint_parser.default
|
|
533
|
+
},
|
|
534
|
+
name: "coderwyd:jsonc:rules",
|
|
535
|
+
rules: {
|
|
536
|
+
"jsonc/no-bigint-literals": "error",
|
|
537
|
+
"jsonc/no-binary-expression": "error",
|
|
538
|
+
"jsonc/no-binary-numeric-literals": "error",
|
|
539
|
+
"jsonc/no-dupe-keys": "error",
|
|
540
|
+
"jsonc/no-escape-sequence-in-identifier": "error",
|
|
541
|
+
"jsonc/no-floating-decimal": "error",
|
|
542
|
+
"jsonc/no-hexadecimal-numeric-literals": "error",
|
|
543
|
+
"jsonc/no-infinity": "error",
|
|
544
|
+
"jsonc/no-multi-str": "error",
|
|
545
|
+
"jsonc/no-nan": "error",
|
|
546
|
+
"jsonc/no-number-props": "error",
|
|
547
|
+
"jsonc/no-numeric-separators": "error",
|
|
548
|
+
"jsonc/no-octal": "error",
|
|
549
|
+
"jsonc/no-octal-escape": "error",
|
|
550
|
+
"jsonc/no-octal-numeric-literals": "error",
|
|
551
|
+
"jsonc/no-parenthesized": "error",
|
|
552
|
+
"jsonc/no-plus-sign": "error",
|
|
553
|
+
"jsonc/no-regexp-literals": "error",
|
|
554
|
+
"jsonc/no-sparse-arrays": "error",
|
|
555
|
+
"jsonc/no-template-literals": "error",
|
|
556
|
+
"jsonc/no-undefined-value": "error",
|
|
557
|
+
"jsonc/no-unicode-codepoint-escapes": "error",
|
|
558
|
+
"jsonc/no-useless-escape": "error",
|
|
559
|
+
"jsonc/space-unary-ops": "error",
|
|
560
|
+
"jsonc/valid-json-number": "error",
|
|
561
|
+
"jsonc/vue-custom-block/no-parsing-error": "error",
|
|
562
|
+
...stylistic2 ? {
|
|
563
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
564
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
565
|
+
"jsonc/comma-style": ["error", "last"],
|
|
566
|
+
"jsonc/indent": ["error", indent],
|
|
567
|
+
"jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
568
|
+
"jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
569
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
570
|
+
"jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
571
|
+
"jsonc/quote-props": "error",
|
|
572
|
+
"jsonc/quotes": "error"
|
|
573
|
+
} : {},
|
|
574
|
+
...overrides
|
|
575
|
+
}
|
|
504
576
|
}
|
|
505
|
-
|
|
506
|
-
|
|
577
|
+
];
|
|
578
|
+
}
|
|
507
579
|
|
|
508
580
|
// src/configs/markdown.ts
|
|
509
581
|
function markdown(options = {}) {
|
|
510
582
|
const {
|
|
511
|
-
componentExts = []
|
|
583
|
+
componentExts = [],
|
|
584
|
+
overrides = {}
|
|
512
585
|
} = options;
|
|
513
586
|
return [
|
|
514
587
|
{
|
|
515
|
-
|
|
588
|
+
name: "coderwyd:markdown:setup",
|
|
516
589
|
plugins: {
|
|
517
590
|
markdown: import_eslint_plugin_markdown.default
|
|
518
|
-
}
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
files: [GLOB_MARKDOWN],
|
|
595
|
+
name: "coderwyd:markdown:processor",
|
|
519
596
|
processor: "markdown/markdown"
|
|
520
597
|
},
|
|
521
598
|
{
|
|
@@ -530,13 +607,10 @@ function markdown(options = {}) {
|
|
|
530
607
|
}
|
|
531
608
|
}
|
|
532
609
|
},
|
|
533
|
-
|
|
534
|
-
ts: import_eslint_plugin2.default
|
|
535
|
-
},
|
|
610
|
+
name: "coderwyd:markdown:rules",
|
|
536
611
|
rules: {
|
|
537
612
|
"antfu/no-cjs-exports": OFF,
|
|
538
613
|
"antfu/no-ts-export-equal": OFF,
|
|
539
|
-
"eol-last": OFF,
|
|
540
614
|
"no-alert": OFF,
|
|
541
615
|
"no-console": OFF,
|
|
542
616
|
"no-undef": OFF,
|
|
@@ -544,6 +618,7 @@ function markdown(options = {}) {
|
|
|
544
618
|
"no-unused-vars": OFF,
|
|
545
619
|
"node/prefer-global/process": OFF,
|
|
546
620
|
"style/comma-dangle": OFF,
|
|
621
|
+
"style/eol-last": OFF,
|
|
547
622
|
"ts/consistent-type-imports": OFF,
|
|
548
623
|
"ts/no-namespace": OFF,
|
|
549
624
|
"ts/no-redeclare": OFF,
|
|
@@ -553,340 +628,395 @@ 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
|
+
name: "coderwyd:node",
|
|
662
|
+
plugins: {
|
|
663
|
+
node: import_eslint_plugin_n.default
|
|
664
|
+
},
|
|
665
|
+
rules: {
|
|
666
|
+
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
667
|
+
"node/no-deprecated-api": "error",
|
|
668
|
+
"node/no-exports-assign": "error",
|
|
669
|
+
"node/no-new-require": "error",
|
|
670
|
+
"node/no-path-concat": "error",
|
|
671
|
+
"node/prefer-global/buffer": ["error", "never"],
|
|
672
|
+
"node/prefer-global/process": ["error", "never"],
|
|
673
|
+
"node/process-exit-as-throw": "error"
|
|
674
|
+
}
|
|
577
675
|
}
|
|
578
|
-
|
|
579
|
-
|
|
676
|
+
];
|
|
677
|
+
}
|
|
580
678
|
|
|
581
679
|
// 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
|
-
|
|
680
|
+
function sortPackageJson() {
|
|
681
|
+
return [
|
|
682
|
+
{
|
|
683
|
+
files: ["**/package.json"],
|
|
684
|
+
name: "coderwyd:sort-package-json",
|
|
685
|
+
rules: {
|
|
686
|
+
"jsonc/sort-array-values": [
|
|
687
|
+
"error",
|
|
688
|
+
{
|
|
689
|
+
order: { type: "asc" },
|
|
690
|
+
pathPattern: "^files$"
|
|
691
|
+
}
|
|
692
|
+
],
|
|
693
|
+
"jsonc/sort-keys": [
|
|
694
|
+
"error",
|
|
695
|
+
{
|
|
696
|
+
order: [
|
|
697
|
+
"publisher",
|
|
698
|
+
"name",
|
|
699
|
+
"displayName",
|
|
700
|
+
"type",
|
|
701
|
+
"version",
|
|
702
|
+
"private",
|
|
703
|
+
"packageManager",
|
|
704
|
+
"description",
|
|
705
|
+
"author",
|
|
706
|
+
"license",
|
|
707
|
+
"funding",
|
|
708
|
+
"homepage",
|
|
709
|
+
"repository",
|
|
710
|
+
"bugs",
|
|
711
|
+
"keywords",
|
|
712
|
+
"categories",
|
|
713
|
+
"sideEffects",
|
|
714
|
+
"exports",
|
|
715
|
+
"main",
|
|
716
|
+
"module",
|
|
717
|
+
"unpkg",
|
|
718
|
+
"jsdelivr",
|
|
719
|
+
"types",
|
|
720
|
+
"typesVersions",
|
|
721
|
+
"bin",
|
|
722
|
+
"icon",
|
|
723
|
+
"files",
|
|
724
|
+
"engines",
|
|
725
|
+
"activationEvents",
|
|
726
|
+
"contributes",
|
|
727
|
+
"scripts",
|
|
728
|
+
"peerDependencies",
|
|
729
|
+
"peerDependenciesMeta",
|
|
730
|
+
"dependencies",
|
|
731
|
+
"optionalDependencies",
|
|
732
|
+
"devDependencies",
|
|
733
|
+
"pnpm",
|
|
734
|
+
"overrides",
|
|
735
|
+
"resolutions",
|
|
736
|
+
"husky",
|
|
737
|
+
"simple-git-hooks",
|
|
738
|
+
"lint-staged",
|
|
739
|
+
"nano-staged",
|
|
740
|
+
"eslintConfig"
|
|
741
|
+
],
|
|
742
|
+
pathPattern: "^$"
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
order: { type: "asc" },
|
|
746
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
order: { type: "asc" },
|
|
750
|
+
pathPattern: "^resolutions$"
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
order: { type: "asc" },
|
|
754
|
+
pathPattern: "^pnpm.overrides$"
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
order: [
|
|
758
|
+
"types",
|
|
759
|
+
"import",
|
|
760
|
+
"require",
|
|
761
|
+
"default"
|
|
762
|
+
],
|
|
763
|
+
pathPattern: "^exports.*$"
|
|
764
|
+
}
|
|
765
|
+
]
|
|
766
|
+
}
|
|
665
767
|
}
|
|
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
|
-
|
|
768
|
+
];
|
|
769
|
+
}
|
|
770
|
+
function sortTsconfig() {
|
|
771
|
+
return [
|
|
772
|
+
{
|
|
773
|
+
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
774
|
+
name: "coderwyd:sort-tsconfig",
|
|
775
|
+
rules: {
|
|
776
|
+
"jsonc/sort-keys": [
|
|
777
|
+
"error",
|
|
778
|
+
{
|
|
779
|
+
order: [
|
|
780
|
+
"extends",
|
|
781
|
+
"compilerOptions",
|
|
782
|
+
"references",
|
|
783
|
+
"files",
|
|
784
|
+
"include",
|
|
785
|
+
"exclude"
|
|
786
|
+
],
|
|
787
|
+
pathPattern: "^$"
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
order: [
|
|
791
|
+
/* Projects */
|
|
792
|
+
"incremental",
|
|
793
|
+
"composite",
|
|
794
|
+
"tsBuildInfoFile",
|
|
795
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
796
|
+
"disableSolutionSearching",
|
|
797
|
+
"disableReferencedProjectLoad",
|
|
798
|
+
/* Language and Environment */
|
|
799
|
+
"target",
|
|
800
|
+
"jsx",
|
|
801
|
+
"jsxFactory",
|
|
802
|
+
"jsxFragmentFactory",
|
|
803
|
+
"jsxImportSource",
|
|
804
|
+
"lib",
|
|
805
|
+
"moduleDetection",
|
|
806
|
+
"noLib",
|
|
807
|
+
"reactNamespace",
|
|
808
|
+
"useDefineForClassFields",
|
|
809
|
+
"emitDecoratorMetadata",
|
|
810
|
+
"experimentalDecorators",
|
|
811
|
+
/* Modules */
|
|
812
|
+
"baseUrl",
|
|
813
|
+
"rootDir",
|
|
814
|
+
"rootDirs",
|
|
815
|
+
"customConditions",
|
|
816
|
+
"module",
|
|
817
|
+
"moduleResolution",
|
|
818
|
+
"moduleSuffixes",
|
|
819
|
+
"noResolve",
|
|
820
|
+
"paths",
|
|
821
|
+
"resolveJsonModule",
|
|
822
|
+
"resolvePackageJsonExports",
|
|
823
|
+
"resolvePackageJsonImports",
|
|
824
|
+
"typeRoots",
|
|
825
|
+
"types",
|
|
826
|
+
"allowArbitraryExtensions",
|
|
827
|
+
"allowImportingTsExtensions",
|
|
828
|
+
"allowUmdGlobalAccess",
|
|
829
|
+
/* JavaScript Support */
|
|
830
|
+
"allowJs",
|
|
831
|
+
"checkJs",
|
|
832
|
+
"maxNodeModuleJsDepth",
|
|
833
|
+
/* Type Checking */
|
|
834
|
+
"strict",
|
|
835
|
+
"strictBindCallApply",
|
|
836
|
+
"strictFunctionTypes",
|
|
837
|
+
"strictNullChecks",
|
|
838
|
+
"strictPropertyInitialization",
|
|
839
|
+
"allowUnreachableCode",
|
|
840
|
+
"allowUnusedLabels",
|
|
841
|
+
"alwaysStrict",
|
|
842
|
+
"exactOptionalPropertyTypes",
|
|
843
|
+
"noFallthroughCasesInSwitch",
|
|
844
|
+
"noImplicitAny",
|
|
845
|
+
"noImplicitOverride",
|
|
846
|
+
"noImplicitReturns",
|
|
847
|
+
"noImplicitThis",
|
|
848
|
+
"noPropertyAccessFromIndexSignature",
|
|
849
|
+
"noUncheckedIndexedAccess",
|
|
850
|
+
"noUnusedLocals",
|
|
851
|
+
"noUnusedParameters",
|
|
852
|
+
"useUnknownInCatchVariables",
|
|
853
|
+
/* Emit */
|
|
854
|
+
"declaration",
|
|
855
|
+
"declarationDir",
|
|
856
|
+
"declarationMap",
|
|
857
|
+
"downlevelIteration",
|
|
858
|
+
"emitBOM",
|
|
859
|
+
"emitDeclarationOnly",
|
|
860
|
+
"importHelpers",
|
|
861
|
+
"importsNotUsedAsValues",
|
|
862
|
+
"inlineSourceMap",
|
|
863
|
+
"inlineSources",
|
|
864
|
+
"mapRoot",
|
|
865
|
+
"newLine",
|
|
866
|
+
"noEmit",
|
|
867
|
+
"noEmitHelpers",
|
|
868
|
+
"noEmitOnError",
|
|
869
|
+
"outDir",
|
|
870
|
+
"outFile",
|
|
871
|
+
"preserveConstEnums",
|
|
872
|
+
"preserveValueImports",
|
|
873
|
+
"removeComments",
|
|
874
|
+
"sourceMap",
|
|
875
|
+
"sourceRoot",
|
|
876
|
+
"stripInternal",
|
|
877
|
+
/* Interop Constraints */
|
|
878
|
+
"allowSyntheticDefaultImports",
|
|
879
|
+
"esModuleInterop",
|
|
880
|
+
"forceConsistentCasingInFileNames",
|
|
881
|
+
"isolatedModules",
|
|
882
|
+
"preserveSymlinks",
|
|
883
|
+
"verbatimModuleSyntax",
|
|
884
|
+
/* Completeness */
|
|
885
|
+
"skipDefaultLibCheck",
|
|
886
|
+
"skipLibCheck"
|
|
887
|
+
],
|
|
888
|
+
pathPattern: "^compilerOptions$"
|
|
889
|
+
}
|
|
890
|
+
]
|
|
891
|
+
}
|
|
787
892
|
}
|
|
788
|
-
|
|
789
|
-
|
|
893
|
+
];
|
|
894
|
+
}
|
|
790
895
|
|
|
791
896
|
// 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
|
-
|
|
897
|
+
function stylistic(options = {}) {
|
|
898
|
+
const {
|
|
899
|
+
indent = 2,
|
|
900
|
+
quotes = "single"
|
|
901
|
+
} = options;
|
|
902
|
+
return [
|
|
903
|
+
{
|
|
904
|
+
name: "coderwyd:stylistic",
|
|
905
|
+
plugins: {
|
|
906
|
+
antfu: import_eslint_plugin_antfu.default,
|
|
907
|
+
style: import_eslint_plugin.default
|
|
908
|
+
},
|
|
909
|
+
rules: {
|
|
910
|
+
"antfu/consistent-list-newline": "error",
|
|
911
|
+
"antfu/if-newline": "error",
|
|
912
|
+
"antfu/top-level-function": "error",
|
|
913
|
+
"curly": ["error", "multi-or-nest", "consistent"],
|
|
914
|
+
"style/array-bracket-spacing": ["error", "never"],
|
|
915
|
+
"style/arrow-spacing": ["error", { after: true, before: true }],
|
|
916
|
+
"style/block-spacing": ["error", "always"],
|
|
917
|
+
"style/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
918
|
+
"style/comma-dangle": ["error", "always-multiline"],
|
|
919
|
+
"style/comma-spacing": ["error", { after: true, before: false }],
|
|
920
|
+
"style/comma-style": ["error", "last"],
|
|
921
|
+
"style/computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
|
|
922
|
+
"style/dot-location": ["error", "property"],
|
|
923
|
+
"style/eol-last": "error",
|
|
924
|
+
"style/indent": ["error", indent, {
|
|
925
|
+
ArrayExpression: 1,
|
|
926
|
+
CallExpression: { arguments: 1 },
|
|
927
|
+
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
928
|
+
FunctionExpression: { body: 1, parameters: 1 },
|
|
929
|
+
ImportDeclaration: 1,
|
|
930
|
+
MemberExpression: 1,
|
|
931
|
+
ObjectExpression: 1,
|
|
932
|
+
SwitchCase: 1,
|
|
933
|
+
VariableDeclarator: 1,
|
|
934
|
+
flatTernaryExpressions: false,
|
|
935
|
+
ignoreComments: false,
|
|
936
|
+
ignoredNodes: [
|
|
937
|
+
"TemplateLiteral *",
|
|
938
|
+
"JSXElement",
|
|
939
|
+
"JSXElement > *",
|
|
940
|
+
"JSXAttribute",
|
|
941
|
+
"JSXIdentifier",
|
|
942
|
+
"JSXNamespacedName",
|
|
943
|
+
"JSXMemberExpression",
|
|
944
|
+
"JSXSpreadAttribute",
|
|
945
|
+
"JSXExpressionContainer",
|
|
946
|
+
"JSXOpeningElement",
|
|
947
|
+
"JSXClosingElement",
|
|
948
|
+
"JSXFragment",
|
|
949
|
+
"JSXOpeningFragment",
|
|
950
|
+
"JSXClosingFragment",
|
|
951
|
+
"JSXText",
|
|
952
|
+
"JSXEmptyExpression",
|
|
953
|
+
"JSXSpreadChild",
|
|
954
|
+
"TSTypeParameterInstantiation",
|
|
955
|
+
"FunctionExpression > .params[decorators.length > 0]",
|
|
956
|
+
"FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
|
|
957
|
+
"ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
|
|
958
|
+
],
|
|
959
|
+
offsetTernaryExpressions: true,
|
|
960
|
+
outerIIFEBody: 1
|
|
961
|
+
}],
|
|
962
|
+
"style/jsx-quotes": "error",
|
|
963
|
+
"style/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
964
|
+
"style/keyword-spacing": ["error", { after: true, before: true }],
|
|
965
|
+
"style/lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
|
|
966
|
+
"style/max-statements-per-line": ["error", { max: 1 }],
|
|
967
|
+
"style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
968
|
+
"style/multiline-ternary": ["error", "always-multiline"],
|
|
969
|
+
"style/new-parens": "error",
|
|
970
|
+
"style/no-extra-parens": ["error", "functions"],
|
|
971
|
+
"style/no-floating-decimal": "error",
|
|
972
|
+
"style/no-mixed-operators": ["error", {
|
|
973
|
+
allowSamePrecedence: true,
|
|
974
|
+
groups: [
|
|
975
|
+
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
|
976
|
+
["&&", "||"],
|
|
977
|
+
["in", "instanceof"]
|
|
978
|
+
]
|
|
979
|
+
}],
|
|
980
|
+
"style/no-mixed-spaces-and-tabs": "error",
|
|
981
|
+
"style/no-multi-spaces": "error",
|
|
982
|
+
"style/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
983
|
+
"style/no-tabs": indent === "tab" ? "off" : "error",
|
|
984
|
+
"style/no-trailing-spaces": "error",
|
|
985
|
+
"style/no-whitespace-before-property": "error",
|
|
986
|
+
"style/object-curly-spacing": ["error", "always"],
|
|
987
|
+
"style/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
988
|
+
"style/operator-linebreak": ["error", "before"],
|
|
989
|
+
"style/padded-blocks": ["error", { blocks: "never", classes: "never", switches: "never" }],
|
|
990
|
+
"style/quote-props": ["error", "consistent-as-needed"],
|
|
991
|
+
"style/quotes": ["error", quotes, { allowTemplateLiterals: true, avoidEscape: false }],
|
|
992
|
+
"style/rest-spread-spacing": ["error", "never"],
|
|
993
|
+
"style/semi": ["error", "never"],
|
|
994
|
+
"style/semi-spacing": ["error", { after: true, before: false }],
|
|
995
|
+
"style/space-before-blocks": ["error", "always"],
|
|
996
|
+
"style/space-before-function-paren": ["error", { anonymous: "always", asyncArrow: "always", named: "never" }],
|
|
997
|
+
"style/space-in-parens": ["error", "never"],
|
|
998
|
+
"style/space-infix-ops": "error",
|
|
999
|
+
"style/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
1000
|
+
"style/spaced-comment": ["error", "always", {
|
|
1001
|
+
block: {
|
|
1002
|
+
balanced: true,
|
|
1003
|
+
exceptions: ["*"],
|
|
1004
|
+
markers: ["!"]
|
|
1005
|
+
},
|
|
1006
|
+
line: {
|
|
1007
|
+
exceptions: ["/", "#"],
|
|
1008
|
+
markers: ["/"]
|
|
1009
|
+
}
|
|
1010
|
+
}],
|
|
1011
|
+
"style/template-curly-spacing": "error",
|
|
1012
|
+
"style/template-tag-spacing": ["error", "never"],
|
|
1013
|
+
"style/type-annotation-spacing": ["error", {}],
|
|
1014
|
+
"style/wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
1015
|
+
"style/yield-star-spacing": ["error", "both"]
|
|
1016
|
+
}
|
|
887
1017
|
}
|
|
888
|
-
|
|
889
|
-
|
|
1018
|
+
];
|
|
1019
|
+
}
|
|
890
1020
|
|
|
891
1021
|
// src/configs/typescript.ts
|
|
892
1022
|
var import_node_process = __toESM(require("process"), 1);
|
|
@@ -908,26 +1038,59 @@ function renameRules(rules, from, to) {
|
|
|
908
1038
|
// src/configs/typescript.ts
|
|
909
1039
|
function typescript(options) {
|
|
910
1040
|
const {
|
|
911
|
-
componentExts = []
|
|
1041
|
+
componentExts = [],
|
|
1042
|
+
overrides = {},
|
|
1043
|
+
parserOptions = {},
|
|
1044
|
+
tsconfigPath
|
|
912
1045
|
} = options ?? {};
|
|
1046
|
+
const typeAwareRules = {
|
|
1047
|
+
"dot-notation": OFF,
|
|
1048
|
+
"no-implied-eval": OFF,
|
|
1049
|
+
"no-throw-literal": OFF,
|
|
1050
|
+
"ts/await-thenable": "error",
|
|
1051
|
+
"ts/ban-types": ["error", { types: { Function: false } }],
|
|
1052
|
+
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
1053
|
+
"ts/no-floating-promises": "error",
|
|
1054
|
+
"ts/no-for-in-array": "error",
|
|
1055
|
+
"ts/no-implied-eval": "error",
|
|
1056
|
+
"ts/no-misused-promises": "error",
|
|
1057
|
+
"ts/no-throw-literal": "error",
|
|
1058
|
+
"ts/no-unnecessary-type-assertion": "error",
|
|
1059
|
+
"ts/no-unsafe-argument": "error",
|
|
1060
|
+
"ts/no-unsafe-assignment": "error",
|
|
1061
|
+
"ts/no-unsafe-call": "error",
|
|
1062
|
+
"ts/no-unsafe-member-access": "error",
|
|
1063
|
+
"ts/no-unsafe-return": "error",
|
|
1064
|
+
"ts/restrict-plus-operands": "error",
|
|
1065
|
+
"ts/restrict-template-expressions": "error",
|
|
1066
|
+
"ts/unbound-method": "error"
|
|
1067
|
+
};
|
|
913
1068
|
return [
|
|
1069
|
+
{
|
|
1070
|
+
name: "coderwyd:typescript:setup",
|
|
1071
|
+
plugins: {
|
|
1072
|
+
antfu: import_eslint_plugin_antfu.default,
|
|
1073
|
+
import: pluginImport,
|
|
1074
|
+
ts: import_eslint_plugin2.default
|
|
1075
|
+
}
|
|
1076
|
+
},
|
|
914
1077
|
{
|
|
915
1078
|
files: [
|
|
916
|
-
|
|
917
|
-
GLOB_TSX,
|
|
1079
|
+
GLOB_SRC,
|
|
918
1080
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
919
1081
|
],
|
|
920
1082
|
languageOptions: {
|
|
921
|
-
parser:
|
|
1083
|
+
parser: parserTs,
|
|
922
1084
|
parserOptions: {
|
|
923
|
-
sourceType: "module"
|
|
1085
|
+
sourceType: "module",
|
|
1086
|
+
...tsconfigPath ? {
|
|
1087
|
+
project: [tsconfigPath],
|
|
1088
|
+
tsconfigRootDir: import_node_process.default.cwd()
|
|
1089
|
+
} : {},
|
|
1090
|
+
...parserOptions
|
|
924
1091
|
}
|
|
925
1092
|
},
|
|
926
|
-
|
|
927
|
-
antfu: import_eslint_plugin_antfu.default,
|
|
928
|
-
import: import_eslint_plugin_i.default,
|
|
929
|
-
ts: import_eslint_plugin2.default
|
|
930
|
-
},
|
|
1093
|
+
name: "coderwyd:typescript:rules",
|
|
931
1094
|
rules: {
|
|
932
1095
|
...renameRules(
|
|
933
1096
|
import_eslint_plugin2.default.configs["eslint-recommended"].overrides[0].rules,
|
|
@@ -942,10 +1105,7 @@ function typescript(options) {
|
|
|
942
1105
|
"antfu/generic-spacing": "error",
|
|
943
1106
|
"antfu/named-tuple-spacing": "error",
|
|
944
1107
|
"antfu/no-cjs-exports": "error",
|
|
945
|
-
"antfu/no-const-enum": "error",
|
|
946
|
-
"antfu/no-ts-export-equal": "error",
|
|
947
1108
|
"no-dupe-class-members": OFF,
|
|
948
|
-
"no-extra-parens": OFF,
|
|
949
1109
|
"no-invalid-this": OFF,
|
|
950
1110
|
"no-loss-of-precision": OFF,
|
|
951
1111
|
"no-redeclare": OFF,
|
|
@@ -958,7 +1118,7 @@ function typescript(options) {
|
|
|
958
1118
|
"ts/no-dupe-class-members": "error",
|
|
959
1119
|
"ts/no-dynamic-delete": OFF,
|
|
960
1120
|
"ts/no-explicit-any": OFF,
|
|
961
|
-
"ts/no-
|
|
1121
|
+
"ts/no-extraneous-class": OFF,
|
|
962
1122
|
"ts/no-invalid-this": "error",
|
|
963
1123
|
"ts/no-invalid-void-type": OFF,
|
|
964
1124
|
"ts/no-loss-of-precision": "error",
|
|
@@ -967,26 +1127,34 @@ function typescript(options) {
|
|
|
967
1127
|
"ts/no-require-imports": "error",
|
|
968
1128
|
"ts/no-unused-vars": OFF,
|
|
969
1129
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
1130
|
+
"ts/no-useless-constructor": OFF,
|
|
970
1131
|
"ts/prefer-ts-expect-error": "error",
|
|
971
|
-
"ts/triple-slash-reference": OFF
|
|
1132
|
+
"ts/triple-slash-reference": OFF,
|
|
1133
|
+
"ts/unified-signatures": OFF,
|
|
1134
|
+
...tsconfigPath ? typeAwareRules : {},
|
|
1135
|
+
...overrides
|
|
972
1136
|
}
|
|
973
1137
|
},
|
|
974
1138
|
{
|
|
975
1139
|
files: ["**/*.d.ts"],
|
|
1140
|
+
name: "coderwyd:typescript:dts-overrides",
|
|
976
1141
|
rules: {
|
|
977
1142
|
"eslint-comments/no-unlimited-disable": OFF,
|
|
978
1143
|
"import/no-duplicates": OFF,
|
|
1144
|
+
"no-restricted-syntax": OFF,
|
|
979
1145
|
"unused-imports/no-unused-vars": OFF
|
|
980
1146
|
}
|
|
981
1147
|
},
|
|
982
1148
|
{
|
|
983
1149
|
files: GLOB_TESTS,
|
|
1150
|
+
name: "coderwyd:typescript:tests-overrides",
|
|
984
1151
|
rules: {
|
|
985
1152
|
"no-unused-expressions": OFF
|
|
986
1153
|
}
|
|
987
1154
|
},
|
|
988
1155
|
{
|
|
989
|
-
files: [
|
|
1156
|
+
files: [GLOB_JS],
|
|
1157
|
+
name: "coderwyd:typescript:javascript-overrides",
|
|
990
1158
|
rules: {
|
|
991
1159
|
"ts/no-require-imports": OFF,
|
|
992
1160
|
"ts/no-var-requires": OFF
|
|
@@ -994,94 +1162,47 @@ function typescript(options) {
|
|
|
994
1162
|
}
|
|
995
1163
|
];
|
|
996
1164
|
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
tsconfigPath,
|
|
1001
|
-
tsconfigRootDir = import_node_process.default.cwd()
|
|
1002
|
-
} = options;
|
|
1165
|
+
|
|
1166
|
+
// src/configs/unicorn.ts
|
|
1167
|
+
function unicorn() {
|
|
1003
1168
|
return [
|
|
1004
1169
|
{
|
|
1005
|
-
|
|
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
|
-
},
|
|
1170
|
+
name: "coderwyd:unicorn",
|
|
1018
1171
|
plugins: {
|
|
1019
|
-
|
|
1172
|
+
unicorn: import_eslint_plugin_unicorn.default
|
|
1020
1173
|
},
|
|
1021
1174
|
rules: {
|
|
1022
|
-
|
|
1023
|
-
"
|
|
1024
|
-
|
|
1025
|
-
"
|
|
1026
|
-
|
|
1027
|
-
"
|
|
1028
|
-
|
|
1029
|
-
"
|
|
1030
|
-
|
|
1031
|
-
"
|
|
1032
|
-
|
|
1033
|
-
"
|
|
1034
|
-
|
|
1035
|
-
"
|
|
1036
|
-
|
|
1037
|
-
"
|
|
1038
|
-
|
|
1039
|
-
"
|
|
1040
|
-
|
|
1175
|
+
// Pass error message when throwing errors
|
|
1176
|
+
"unicorn/error-message": "error",
|
|
1177
|
+
// Uppercase regex escapes
|
|
1178
|
+
"unicorn/escape-case": "error",
|
|
1179
|
+
// Array.isArray instead of instanceof
|
|
1180
|
+
"unicorn/no-instanceof-array": "error",
|
|
1181
|
+
// Ban `new Array` as `Array` constructor's params are ambiguous
|
|
1182
|
+
"unicorn/no-new-array": "error",
|
|
1183
|
+
// Prevent deprecated `new Buffer()`
|
|
1184
|
+
"unicorn/no-new-buffer": "error",
|
|
1185
|
+
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
1186
|
+
"unicorn/number-literal-case": "error",
|
|
1187
|
+
// textContent instead of innerText
|
|
1188
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
1189
|
+
// includes over indexOf when checking for existence
|
|
1190
|
+
"unicorn/prefer-includes": "error",
|
|
1191
|
+
// Prefer using the node: protocol
|
|
1192
|
+
"unicorn/prefer-node-protocol": "error",
|
|
1193
|
+
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
1194
|
+
"unicorn/prefer-number-properties": "error",
|
|
1195
|
+
// String methods startsWith/endsWith instead of more complicated stuff
|
|
1196
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1197
|
+
// Enforce throwing type error when throwing error while checking typeof
|
|
1198
|
+
"unicorn/prefer-type-error": "error",
|
|
1199
|
+
// Use new when throwing error
|
|
1200
|
+
"unicorn/throw-new-error": "error"
|
|
1041
1201
|
}
|
|
1042
1202
|
}
|
|
1043
1203
|
];
|
|
1044
1204
|
}
|
|
1045
1205
|
|
|
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
1206
|
// src/configs/vue.ts
|
|
1086
1207
|
var import_node_process2 = __toESM(require("process"), 1);
|
|
1087
1208
|
var import_local_pkg = require("local-pkg");
|
|
@@ -1105,7 +1226,20 @@ var vue2Rules = {
|
|
|
1105
1226
|
...import_eslint_plugin_vue.default.configs.recommended.rules
|
|
1106
1227
|
};
|
|
1107
1228
|
function vue(options = {}) {
|
|
1229
|
+
const {
|
|
1230
|
+
overrides = {},
|
|
1231
|
+
stylistic: stylistic2 = true
|
|
1232
|
+
} = options;
|
|
1233
|
+
const {
|
|
1234
|
+
indent = 2
|
|
1235
|
+
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1108
1236
|
return [
|
|
1237
|
+
{
|
|
1238
|
+
name: "coderwyd:vue:setup",
|
|
1239
|
+
plugins: {
|
|
1240
|
+
vue: import_eslint_plugin_vue.default
|
|
1241
|
+
}
|
|
1242
|
+
},
|
|
1109
1243
|
{
|
|
1110
1244
|
files: [GLOB_VUE],
|
|
1111
1245
|
languageOptions: {
|
|
@@ -1115,31 +1249,18 @@ function vue(options = {}) {
|
|
|
1115
1249
|
jsx: true
|
|
1116
1250
|
},
|
|
1117
1251
|
extraFileExtensions: [".vue"],
|
|
1118
|
-
parser: options.typescript ?
|
|
1252
|
+
parser: options.typescript ? parserTs : null,
|
|
1119
1253
|
sourceType: "module"
|
|
1120
1254
|
}
|
|
1121
1255
|
},
|
|
1122
|
-
|
|
1123
|
-
vue: import_eslint_plugin_vue.default
|
|
1124
|
-
},
|
|
1256
|
+
name: "coderwyd:vue:rules",
|
|
1125
1257
|
processor: import_eslint_plugin_vue.default.processors[".vue"],
|
|
1126
1258
|
rules: {
|
|
1127
1259
|
...isVue3 ? vue3Rules : vue2Rules,
|
|
1128
1260
|
"node/prefer-global/process": OFF,
|
|
1129
|
-
"vue/array-bracket-spacing": ["error", "never"],
|
|
1130
|
-
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1131
1261
|
"vue/block-order": ["error", {
|
|
1132
1262
|
order: ["script", "template", "style"]
|
|
1133
1263
|
}],
|
|
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
1264
|
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1144
1265
|
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1145
1266
|
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
@@ -1149,11 +1270,8 @@ function vue(options = {}) {
|
|
|
1149
1270
|
"vue/dot-location": ["error", "property"],
|
|
1150
1271
|
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1151
1272
|
"vue/eqeqeq": ["error", "smart"],
|
|
1152
|
-
"vue/html-
|
|
1153
|
-
|
|
1154
|
-
}],
|
|
1155
|
-
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1156
|
-
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1273
|
+
"vue/html-indent": ["error", indent],
|
|
1274
|
+
"vue/html-quotes": ["error", "double"],
|
|
1157
1275
|
"vue/max-attributes-per-line": OFF,
|
|
1158
1276
|
"vue/multi-word-component-names": OFF,
|
|
1159
1277
|
"vue/no-dupe-keys": OFF,
|
|
@@ -1173,10 +1291,6 @@ function vue(options = {}) {
|
|
|
1173
1291
|
"vue/no-unused-refs": "error",
|
|
1174
1292
|
"vue/no-useless-v-bind": "error",
|
|
1175
1293
|
"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
1294
|
"vue/object-shorthand": [
|
|
1181
1295
|
"error",
|
|
1182
1296
|
"always",
|
|
@@ -1185,99 +1299,309 @@ function vue(options = {}) {
|
|
|
1185
1299
|
ignoreConstructors: false
|
|
1186
1300
|
}
|
|
1187
1301
|
],
|
|
1188
|
-
"vue/operator-linebreak": ["error", "before"],
|
|
1189
|
-
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1190
1302
|
"vue/prefer-separate-static-class": "error",
|
|
1191
1303
|
"vue/prefer-template": "error",
|
|
1192
|
-
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1193
1304
|
"vue/require-default-prop": OFF,
|
|
1194
1305
|
"vue/require-prop-types": OFF,
|
|
1195
|
-
"vue/space-in-parens": ["error", "never"],
|
|
1196
1306
|
"vue/space-infix-ops": "error",
|
|
1197
1307
|
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
1198
|
-
|
|
1308
|
+
...stylistic2 ? {
|
|
1309
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
1310
|
+
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1311
|
+
"vue/block-spacing": ["error", "always"],
|
|
1312
|
+
"vue/block-tag-newline": ["error", {
|
|
1313
|
+
multiline: "always",
|
|
1314
|
+
singleline: "always"
|
|
1315
|
+
}],
|
|
1316
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1317
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1318
|
+
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1319
|
+
"vue/comma-style": ["error", "last"],
|
|
1320
|
+
"vue/html-comment-content-spacing": ["error", "always", {
|
|
1321
|
+
exceptions: ["-"]
|
|
1322
|
+
}],
|
|
1323
|
+
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1324
|
+
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1325
|
+
"vue/object-curly-newline": OFF,
|
|
1326
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
1327
|
+
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1328
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
1329
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1330
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1331
|
+
"vue/space-in-parens": ["error", "never"],
|
|
1332
|
+
"vue/template-curly-spacing": "error"
|
|
1333
|
+
} : {},
|
|
1334
|
+
...overrides
|
|
1199
1335
|
}
|
|
1200
1336
|
}
|
|
1201
1337
|
];
|
|
1202
1338
|
}
|
|
1203
1339
|
|
|
1204
|
-
// src/configs/
|
|
1205
|
-
|
|
1206
|
-
{
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1340
|
+
// src/configs/yaml.ts
|
|
1341
|
+
function yaml(options = {}) {
|
|
1342
|
+
const {
|
|
1343
|
+
overrides = {},
|
|
1344
|
+
stylistic: stylistic2 = true
|
|
1345
|
+
} = options;
|
|
1346
|
+
const {
|
|
1347
|
+
indent = 2,
|
|
1348
|
+
quotes = "single"
|
|
1349
|
+
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1350
|
+
return [
|
|
1351
|
+
{
|
|
1352
|
+
name: "coderwyd:yaml:setup",
|
|
1353
|
+
plugins: {
|
|
1354
|
+
yaml: pluginYaml
|
|
1355
|
+
}
|
|
1213
1356
|
},
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1357
|
+
{
|
|
1358
|
+
files: [GLOB_YAML],
|
|
1359
|
+
languageOptions: {
|
|
1360
|
+
parser: import_yaml_eslint_parser.default
|
|
1361
|
+
},
|
|
1362
|
+
name: "coderwyd:yaml:rules",
|
|
1363
|
+
rules: {
|
|
1364
|
+
"style/spaced-comment": OFF,
|
|
1365
|
+
"yaml/block-mapping": "error",
|
|
1366
|
+
"yaml/block-sequence": "error",
|
|
1367
|
+
"yaml/no-empty-key": "error",
|
|
1368
|
+
"yaml/no-empty-sequence-entry": "error",
|
|
1369
|
+
"yaml/no-irregular-whitespace": "error",
|
|
1370
|
+
"yaml/plain-scalar": "error",
|
|
1371
|
+
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
1372
|
+
...stylistic2 ? {
|
|
1373
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
1374
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
1375
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
1376
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
1377
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
1378
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
1379
|
+
"yaml/indent": ["error", indent === "tab" ? 2 : indent],
|
|
1380
|
+
"yaml/key-spacing": "error",
|
|
1381
|
+
"yaml/no-tab-indent": "error",
|
|
1382
|
+
"yaml/quotes": ["error", { avoidEscape: false, prefer: quotes }],
|
|
1383
|
+
"yaml/spaced-comment": "error"
|
|
1384
|
+
} : {},
|
|
1385
|
+
...overrides
|
|
1386
|
+
}
|
|
1234
1387
|
}
|
|
1235
|
-
|
|
1236
|
-
|
|
1388
|
+
];
|
|
1389
|
+
}
|
|
1237
1390
|
|
|
1238
1391
|
// src/configs/test.ts
|
|
1239
1392
|
function test(options = {}) {
|
|
1393
|
+
const {
|
|
1394
|
+
isInEditor = false,
|
|
1395
|
+
overrides = {}
|
|
1396
|
+
} = options;
|
|
1240
1397
|
return [
|
|
1241
1398
|
{
|
|
1242
|
-
|
|
1399
|
+
name: "coderwyd:test:setup",
|
|
1243
1400
|
plugins: {
|
|
1244
|
-
|
|
1245
|
-
|
|
1401
|
+
test: {
|
|
1402
|
+
...import_eslint_plugin_vitest.default,
|
|
1403
|
+
rules: {
|
|
1404
|
+
...import_eslint_plugin_vitest.default.rules,
|
|
1405
|
+
// extend `test/no-only-tests` rule
|
|
1406
|
+
...import_eslint_plugin_no_only_tests.default.rules
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
},
|
|
1411
|
+
{
|
|
1412
|
+
files: GLOB_TESTS,
|
|
1413
|
+
name: "coderwyd:test:rules",
|
|
1246
1414
|
rules: {
|
|
1247
|
-
"
|
|
1415
|
+
"test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
|
|
1416
|
+
"test/no-identical-title": "error",
|
|
1417
|
+
"test/no-only-tests": isInEditor ? OFF : "error",
|
|
1418
|
+
"test/prefer-hooks-in-order": "error",
|
|
1419
|
+
"test/prefer-lowercase-title": "error",
|
|
1420
|
+
...overrides
|
|
1248
1421
|
}
|
|
1249
1422
|
}
|
|
1250
1423
|
];
|
|
1251
1424
|
}
|
|
1252
1425
|
|
|
1253
1426
|
// src/configs/react.ts
|
|
1427
|
+
var import_globals2 = __toESM(require("globals"), 1);
|
|
1254
1428
|
function react(options = {}) {
|
|
1429
|
+
const {
|
|
1430
|
+
overrides = {},
|
|
1431
|
+
stylistic: stylistic2 = true
|
|
1432
|
+
} = options;
|
|
1433
|
+
const {
|
|
1434
|
+
indent = 2
|
|
1435
|
+
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1436
|
+
const extensions = [GLOB_JSX, ...[options.typescript ? GLOB_TSX : ""]];
|
|
1255
1437
|
return [
|
|
1256
1438
|
{
|
|
1257
|
-
|
|
1439
|
+
name: "coderwyd:react:setup",
|
|
1440
|
+
plugins: {
|
|
1441
|
+
"react": import_eslint_plugin_react.default,
|
|
1442
|
+
"react-hooks": import_eslint_plugin_react_hooks.default
|
|
1443
|
+
},
|
|
1444
|
+
settings: {
|
|
1445
|
+
"import/extensions": extensions,
|
|
1446
|
+
"import/resolver": {
|
|
1447
|
+
node: { extensions }
|
|
1448
|
+
},
|
|
1449
|
+
"react": {
|
|
1450
|
+
version: "detect"
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
},
|
|
1454
|
+
{
|
|
1455
|
+
files: [GLOB_JSX, ...[options.typescript ? GLOB_TSX : ""]],
|
|
1258
1456
|
languageOptions: {
|
|
1457
|
+
globals: import_globals2.default.browser,
|
|
1259
1458
|
parserOptions: {
|
|
1260
1459
|
ecmaFeatures: {
|
|
1261
1460
|
jsx: true
|
|
1262
1461
|
},
|
|
1263
|
-
|
|
1264
|
-
|
|
1462
|
+
// for @typescript/eslint-parser
|
|
1463
|
+
jsxPragma: void 0,
|
|
1464
|
+
// FIXME: @typescript-eslint v6 throws deprecation warnings
|
|
1465
|
+
// See https://github.com/jsx-eslint/eslint-plugin-react/issues/3602
|
|
1466
|
+
// Remove this when they support typescript 5.2
|
|
1467
|
+
suppressDeprecatedPropertyWarnings: true
|
|
1265
1468
|
}
|
|
1266
1469
|
},
|
|
1267
|
-
|
|
1268
|
-
"react": import_eslint_plugin_react.default,
|
|
1269
|
-
"react-hooks": import_eslint_plugin_react_hooks.default
|
|
1270
|
-
},
|
|
1470
|
+
name: "coderwyd:react:rules",
|
|
1271
1471
|
rules: {
|
|
1272
|
-
"jsx-quotes": ["error", "prefer-double"],
|
|
1273
1472
|
...import_eslint_plugin_react.default.configs.recommended.rules,
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
react: {
|
|
1279
|
-
|
|
1280
|
-
|
|
1473
|
+
...import_eslint_plugin_react_hooks.default.configs.recommended.rules,
|
|
1474
|
+
"node/prefer-global/process": OFF,
|
|
1475
|
+
"react/display-name": ["off", { ignoreTranspilerName: false }],
|
|
1476
|
+
"react/iframe-missing-sandbox": "warn",
|
|
1477
|
+
"react/jsx-curly-brace-presence": ["error", { children: "never", props: "never" }],
|
|
1478
|
+
"react/no-unknown-property": ["error", {
|
|
1479
|
+
ignore: [
|
|
1480
|
+
// SVG
|
|
1481
|
+
"clip-path",
|
|
1482
|
+
"clip-rule",
|
|
1483
|
+
"fill-opacity",
|
|
1484
|
+
"fill-rule",
|
|
1485
|
+
"stroke-dasharray",
|
|
1486
|
+
"stroke-dashoffset",
|
|
1487
|
+
"stroke-linecap",
|
|
1488
|
+
"stroke-linejoin",
|
|
1489
|
+
"stroke-miterlimit",
|
|
1490
|
+
"stroke-opacity",
|
|
1491
|
+
"stroke-width"
|
|
1492
|
+
]
|
|
1493
|
+
}],
|
|
1494
|
+
"react/no-unused-class-component-methods": "error",
|
|
1495
|
+
"react/no-unused-state": "error",
|
|
1496
|
+
"react/prop-types": "off",
|
|
1497
|
+
"react/react-in-jsx-scope": "off",
|
|
1498
|
+
...stylistic2 ? {
|
|
1499
|
+
"react/jsx-boolean-value": ["error", "never", { always: [] }],
|
|
1500
|
+
"react/jsx-closing-bracket-location": ["error", "tag-aligned"],
|
|
1501
|
+
"react/jsx-curly-newline": ["error", {
|
|
1502
|
+
multiline: "consistent",
|
|
1503
|
+
singleline: "consistent"
|
|
1504
|
+
}],
|
|
1505
|
+
"react/jsx-curly-spacing": ["error", "never", { allowMultiline: true }],
|
|
1506
|
+
"react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
|
|
1507
|
+
"react/jsx-fragments": ["error", "syntax"],
|
|
1508
|
+
"react/jsx-indent": ["error", indent, { checkAttributes: false, indentLogicalExpressions: true }],
|
|
1509
|
+
"react/jsx-indent-props": ["error", indent],
|
|
1510
|
+
"react/jsx-max-props-per-line": ["error", { maximum: 1, when: "multiline" }],
|
|
1511
|
+
"react/jsx-no-useless-fragment": "error",
|
|
1512
|
+
"react/jsx-props-no-multi-spaces": "error",
|
|
1513
|
+
"react/jsx-tag-spacing": ["error", {
|
|
1514
|
+
afterOpening: "never",
|
|
1515
|
+
beforeClosing: "never",
|
|
1516
|
+
beforeSelfClosing: "always",
|
|
1517
|
+
closingSlash: "never"
|
|
1518
|
+
}],
|
|
1519
|
+
"react/jsx-wrap-multilines": ["error", {
|
|
1520
|
+
arrow: "parens-new-line",
|
|
1521
|
+
assignment: "parens-new-line",
|
|
1522
|
+
condition: "parens-new-line",
|
|
1523
|
+
declaration: "parens-new-line",
|
|
1524
|
+
logical: "parens-new-line",
|
|
1525
|
+
prop: "parens-new-line",
|
|
1526
|
+
return: "parens-new-line"
|
|
1527
|
+
}],
|
|
1528
|
+
"react/sort-comp": ["error", {
|
|
1529
|
+
groups: {
|
|
1530
|
+
lifecycle: [
|
|
1531
|
+
"displayName",
|
|
1532
|
+
"propTypes",
|
|
1533
|
+
"contextTypes",
|
|
1534
|
+
"childContextTypes",
|
|
1535
|
+
"mixins",
|
|
1536
|
+
"statics",
|
|
1537
|
+
"defaultProps",
|
|
1538
|
+
"constructor",
|
|
1539
|
+
"getDefaultProps",
|
|
1540
|
+
"getInitialState",
|
|
1541
|
+
"state",
|
|
1542
|
+
"getChildContext",
|
|
1543
|
+
"getDerivedStateFromProps",
|
|
1544
|
+
"componentWillMount",
|
|
1545
|
+
"UNSAFE_componentWillMount",
|
|
1546
|
+
"componentDidMount",
|
|
1547
|
+
"componentWillReceiveProps",
|
|
1548
|
+
"UNSAFE_componentWillReceiveProps",
|
|
1549
|
+
"shouldComponentUpdate",
|
|
1550
|
+
"componentWillUpdate",
|
|
1551
|
+
"UNSAFE_componentWillUpdate",
|
|
1552
|
+
"getSnapshotBeforeUpdate",
|
|
1553
|
+
"componentDidUpdate",
|
|
1554
|
+
"componentDidCatch",
|
|
1555
|
+
"componentWillUnmount"
|
|
1556
|
+
],
|
|
1557
|
+
rendering: [
|
|
1558
|
+
"/^render.+$/",
|
|
1559
|
+
"render"
|
|
1560
|
+
]
|
|
1561
|
+
},
|
|
1562
|
+
order: [
|
|
1563
|
+
"static-variables",
|
|
1564
|
+
"static-methods",
|
|
1565
|
+
"instance-variables",
|
|
1566
|
+
"lifecycle",
|
|
1567
|
+
"/^handle.+$/",
|
|
1568
|
+
"/^on.+$/",
|
|
1569
|
+
"getters",
|
|
1570
|
+
"setters",
|
|
1571
|
+
"/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/",
|
|
1572
|
+
"instance-methods",
|
|
1573
|
+
"everything-else",
|
|
1574
|
+
"rendering"
|
|
1575
|
+
]
|
|
1576
|
+
}],
|
|
1577
|
+
"react/style-prop-object": "error",
|
|
1578
|
+
"style/indent": ["error", indent, {
|
|
1579
|
+
SwitchCase: 1,
|
|
1580
|
+
VariableDeclarator: 1,
|
|
1581
|
+
// from: https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
|
|
1582
|
+
ignoredNodes: [
|
|
1583
|
+
"JSXElement",
|
|
1584
|
+
"JSXElement :not(JSXExpressionContainer, JSXExpressionContainer *)",
|
|
1585
|
+
"JSXAttribute",
|
|
1586
|
+
"JSXIdentifier",
|
|
1587
|
+
"JSXNamespacedName",
|
|
1588
|
+
"JSXMemberExpression",
|
|
1589
|
+
"JSXSpreadAttribute",
|
|
1590
|
+
"JSXOpeningElement",
|
|
1591
|
+
"JSXClosingElement",
|
|
1592
|
+
"JSXFragment",
|
|
1593
|
+
"JSXOpeningFragment",
|
|
1594
|
+
"JSXClosingFragment",
|
|
1595
|
+
"JSXText",
|
|
1596
|
+
"JSXEmptyExpression",
|
|
1597
|
+
"JSXSpreadChild"
|
|
1598
|
+
],
|
|
1599
|
+
offsetTernaryExpressions: true,
|
|
1600
|
+
outerIIFEBody: 1
|
|
1601
|
+
}],
|
|
1602
|
+
"style/jsx-quotes": ["error", "prefer-double"]
|
|
1603
|
+
} : {},
|
|
1604
|
+
...overrides
|
|
1281
1605
|
}
|
|
1282
1606
|
}
|
|
1283
1607
|
];
|
|
@@ -1285,6 +1609,7 @@ function react(options = {}) {
|
|
|
1285
1609
|
|
|
1286
1610
|
// src/configs/astro.ts
|
|
1287
1611
|
function astro(options = {}) {
|
|
1612
|
+
const { overrides = {} } = options;
|
|
1288
1613
|
return [
|
|
1289
1614
|
{
|
|
1290
1615
|
files: [GLOB_ASTRO],
|
|
@@ -1292,14 +1617,16 @@ function astro(options = {}) {
|
|
|
1292
1617
|
parser: import_astro_eslint_parser.default,
|
|
1293
1618
|
parserOptions: {
|
|
1294
1619
|
extraFileExtensions: [".astro"],
|
|
1295
|
-
parser: options.typescript ?
|
|
1620
|
+
parser: options.typescript ? parserTs : null
|
|
1296
1621
|
}
|
|
1297
1622
|
},
|
|
1623
|
+
name: "coderwyd:astro",
|
|
1298
1624
|
plugins: {
|
|
1299
1625
|
astro: import_eslint_plugin_astro.default
|
|
1300
1626
|
},
|
|
1301
1627
|
rules: {
|
|
1302
|
-
...import_eslint_plugin_astro.default.configs.recommended.rules
|
|
1628
|
+
...import_eslint_plugin_astro.default.configs.recommended.rules,
|
|
1629
|
+
...overrides
|
|
1303
1630
|
}
|
|
1304
1631
|
}
|
|
1305
1632
|
];
|
|
@@ -1316,14 +1643,31 @@ var flatConfigProps = [
|
|
|
1316
1643
|
"rules",
|
|
1317
1644
|
"settings"
|
|
1318
1645
|
];
|
|
1646
|
+
var VuePackages = [
|
|
1647
|
+
"vue",
|
|
1648
|
+
"nuxt",
|
|
1649
|
+
"vitepress",
|
|
1650
|
+
"@slidev/cli"
|
|
1651
|
+
];
|
|
1652
|
+
var ReactPackages = [
|
|
1653
|
+
"react",
|
|
1654
|
+
"next"
|
|
1655
|
+
];
|
|
1656
|
+
var AstroPackages = [
|
|
1657
|
+
"astro"
|
|
1658
|
+
];
|
|
1319
1659
|
function coderwyd(options = {}, ...userConfigs) {
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1660
|
+
const {
|
|
1661
|
+
isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE) && !import_node_process3.default.env.CI),
|
|
1662
|
+
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg2.isPackageExists)(i)),
|
|
1663
|
+
react: enableReact = ReactPackages.some((i) => (0, import_local_pkg2.isPackageExists)(i)),
|
|
1664
|
+
astro: enableAstro = AstroPackages.some((i) => (0, import_local_pkg2.isPackageExists)(i)),
|
|
1665
|
+
typescript: enableTypeScript = (0, import_local_pkg2.isPackageExists)("typescript"),
|
|
1666
|
+
stylistic: enableStylistic = true,
|
|
1667
|
+
gitignore: enableGitignore = true,
|
|
1668
|
+
overrides = {},
|
|
1669
|
+
componentExts = []
|
|
1670
|
+
} = options;
|
|
1327
1671
|
const configs = [];
|
|
1328
1672
|
if (enableGitignore) {
|
|
1329
1673
|
if (typeof enableGitignore !== "boolean") {
|
|
@@ -1334,47 +1678,68 @@ function coderwyd(options = {}, ...userConfigs) {
|
|
|
1334
1678
|
}
|
|
1335
1679
|
}
|
|
1336
1680
|
configs.push(
|
|
1337
|
-
ignores,
|
|
1681
|
+
ignores(),
|
|
1338
1682
|
javascript({ isInEditor }),
|
|
1339
|
-
comments,
|
|
1340
|
-
node,
|
|
1341
|
-
jsdoc
|
|
1342
|
-
|
|
1343
|
-
|
|
1683
|
+
comments(),
|
|
1684
|
+
node(),
|
|
1685
|
+
jsdoc({
|
|
1686
|
+
stylistic: enableStylistic
|
|
1687
|
+
}),
|
|
1688
|
+
imports({
|
|
1689
|
+
stylistic: enableStylistic
|
|
1690
|
+
}),
|
|
1691
|
+
unicorn()
|
|
1344
1692
|
);
|
|
1345
|
-
const componentExts = [];
|
|
1346
1693
|
if (enableVue)
|
|
1347
1694
|
componentExts.push("vue");
|
|
1348
1695
|
if (enableTypeScript) {
|
|
1349
|
-
configs.push(typescript({
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1696
|
+
configs.push(typescript({
|
|
1697
|
+
...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
|
|
1698
|
+
componentExts,
|
|
1699
|
+
overrides: overrides.typescript
|
|
1700
|
+
}));
|
|
1701
|
+
}
|
|
1702
|
+
if (enableStylistic) {
|
|
1703
|
+
configs.push(stylistic(
|
|
1704
|
+
typeof enableStylistic === "boolean" ? {} : enableStylistic
|
|
1705
|
+
));
|
|
1356
1706
|
}
|
|
1357
|
-
if (enableStylistic)
|
|
1358
|
-
configs.push(stylistic);
|
|
1359
1707
|
if (options.test ?? true)
|
|
1360
|
-
configs.push(test({ isInEditor }));
|
|
1361
|
-
if (enableVue)
|
|
1362
|
-
configs.push(vue({
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1708
|
+
configs.push(test({ isInEditor, overrides: overrides.test }));
|
|
1709
|
+
if (enableVue) {
|
|
1710
|
+
configs.push(vue({
|
|
1711
|
+
overrides: overrides.vue,
|
|
1712
|
+
stylistic: enableStylistic,
|
|
1713
|
+
typescript: !!enableTypeScript
|
|
1714
|
+
}));
|
|
1715
|
+
}
|
|
1716
|
+
if (enableReact) {
|
|
1717
|
+
configs.push(react({
|
|
1718
|
+
overrides: overrides.react,
|
|
1719
|
+
typescript: !!enableTypeScript
|
|
1720
|
+
}));
|
|
1721
|
+
}
|
|
1722
|
+
if (enableAstro) {
|
|
1723
|
+
configs.push(astro({
|
|
1724
|
+
overrides: overrides.astro,
|
|
1725
|
+
typescript: !!enableTypeScript
|
|
1726
|
+
}));
|
|
1727
|
+
}
|
|
1367
1728
|
if (options.jsonc ?? true) {
|
|
1368
1729
|
configs.push(
|
|
1369
|
-
jsonc,
|
|
1370
|
-
sortPackageJson,
|
|
1371
|
-
sortTsconfig
|
|
1730
|
+
jsonc(),
|
|
1731
|
+
sortPackageJson(),
|
|
1732
|
+
sortTsconfig()
|
|
1372
1733
|
);
|
|
1373
1734
|
}
|
|
1374
|
-
if (options.yaml ?? true)
|
|
1375
|
-
configs.push(
|
|
1735
|
+
if (options.yaml ?? true) {
|
|
1736
|
+
configs.push(yaml({
|
|
1737
|
+
overrides: overrides.yaml,
|
|
1738
|
+
stylistic: enableStylistic
|
|
1739
|
+
}));
|
|
1740
|
+
}
|
|
1376
1741
|
if (options.markdown ?? true)
|
|
1377
|
-
configs.push(markdown({ componentExts }));
|
|
1742
|
+
configs.push(markdown({ componentExts, overrides: overrides.markdown }));
|
|
1378
1743
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
1379
1744
|
if (key in options)
|
|
1380
1745
|
acc[key] = options[key];
|
|
@@ -1393,6 +1758,28 @@ function coderwyd(options = {}, ...userConfigs) {
|
|
|
1393
1758
|
var src_default = coderwyd;
|
|
1394
1759
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1395
1760
|
0 && (module.exports = {
|
|
1761
|
+
GLOB_ALL_SRC,
|
|
1762
|
+
GLOB_ASTRO,
|
|
1763
|
+
GLOB_CSS,
|
|
1764
|
+
GLOB_EXCLUDE,
|
|
1765
|
+
GLOB_HTML,
|
|
1766
|
+
GLOB_JS,
|
|
1767
|
+
GLOB_JSON,
|
|
1768
|
+
GLOB_JSON5,
|
|
1769
|
+
GLOB_JSONC,
|
|
1770
|
+
GLOB_JSX,
|
|
1771
|
+
GLOB_LESS,
|
|
1772
|
+
GLOB_MARKDOWN,
|
|
1773
|
+
GLOB_MARKDOWN_CODE,
|
|
1774
|
+
GLOB_SCSS,
|
|
1775
|
+
GLOB_SRC,
|
|
1776
|
+
GLOB_SRC_EXT,
|
|
1777
|
+
GLOB_STYLE,
|
|
1778
|
+
GLOB_TESTS,
|
|
1779
|
+
GLOB_TS,
|
|
1780
|
+
GLOB_TSX,
|
|
1781
|
+
GLOB_VUE,
|
|
1782
|
+
GLOB_YAML,
|
|
1396
1783
|
astro,
|
|
1397
1784
|
coderwyd,
|
|
1398
1785
|
combine,
|
|
@@ -1409,7 +1796,7 @@ var src_default = coderwyd;
|
|
|
1409
1796
|
parserJsonc,
|
|
1410
1797
|
parserTs,
|
|
1411
1798
|
parserVue,
|
|
1412
|
-
|
|
1799
|
+
parserYaml,
|
|
1413
1800
|
pluginAntfu,
|
|
1414
1801
|
pluginAstro,
|
|
1415
1802
|
pluginComments,
|
|
@@ -1425,8 +1812,9 @@ var src_default = coderwyd;
|
|
|
1425
1812
|
pluginTs,
|
|
1426
1813
|
pluginUnicorn,
|
|
1427
1814
|
pluginUnusedImports,
|
|
1815
|
+
pluginVitest,
|
|
1428
1816
|
pluginVue,
|
|
1429
|
-
|
|
1817
|
+
pluginYaml,
|
|
1430
1818
|
react,
|
|
1431
1819
|
renameRules,
|
|
1432
1820
|
sortPackageJson,
|
|
@@ -1434,8 +1822,7 @@ var src_default = coderwyd;
|
|
|
1434
1822
|
stylistic,
|
|
1435
1823
|
test,
|
|
1436
1824
|
typescript,
|
|
1437
|
-
typescriptWithLanguageServer,
|
|
1438
1825
|
unicorn,
|
|
1439
1826
|
vue,
|
|
1440
|
-
|
|
1827
|
+
yaml
|
|
1441
1828
|
});
|