@coderwyd/eslint-config 1.1.0-beta.2 → 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 +35 -5
- package/dist/index.cjs +348 -144
- package/dist/index.d.cts +78 -11
- package/dist/index.d.ts +78 -11
- package/dist/index.js +393 -190
- package/package.json +16 -11
package/dist/index.cjs
CHANGED
|
@@ -67,15 +67,15 @@ __export(src_exports, {
|
|
|
67
67
|
node: () => node,
|
|
68
68
|
parserAstro: () => import_astro_eslint_parser.default,
|
|
69
69
|
parserJsonc: () => import_jsonc_eslint_parser.default,
|
|
70
|
-
parserTs: () =>
|
|
70
|
+
parserTs: () => parserTs,
|
|
71
71
|
parserVue: () => import_vue_eslint_parser.default,
|
|
72
72
|
parserYaml: () => import_yaml_eslint_parser.default,
|
|
73
73
|
pluginAntfu: () => import_eslint_plugin_antfu.default,
|
|
74
74
|
pluginAstro: () => import_eslint_plugin_astro.default,
|
|
75
75
|
pluginComments: () => import_eslint_plugin_eslint_comments.default,
|
|
76
|
-
pluginImport: () =>
|
|
76
|
+
pluginImport: () => pluginImport,
|
|
77
77
|
pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
|
|
78
|
-
pluginJsonc: () =>
|
|
78
|
+
pluginJsonc: () => pluginJsonc,
|
|
79
79
|
pluginMarkdown: () => import_eslint_plugin_markdown.default,
|
|
80
80
|
pluginNoOnlyTests: () => import_eslint_plugin_no_only_tests.default,
|
|
81
81
|
pluginNode: () => import_eslint_plugin_n.default,
|
|
@@ -85,8 +85,9 @@ __export(src_exports, {
|
|
|
85
85
|
pluginTs: () => import_eslint_plugin2.default,
|
|
86
86
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
87
87
|
pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
|
|
88
|
+
pluginVitest: () => import_eslint_plugin_vitest.default,
|
|
88
89
|
pluginVue: () => import_eslint_plugin_vue.default,
|
|
89
|
-
pluginYaml: () =>
|
|
90
|
+
pluginYaml: () => pluginYaml,
|
|
90
91
|
react: () => react,
|
|
91
92
|
renameRules: () => renameRules,
|
|
92
93
|
sortPackageJson: () => sortPackageJson,
|
|
@@ -109,22 +110,23 @@ var import_eslint_config_flat_gitignore = __toESM(require("eslint-config-flat-gi
|
|
|
109
110
|
// src/plugins.ts
|
|
110
111
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
111
112
|
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
112
|
-
var
|
|
113
|
+
var pluginImport = __toESM(require("eslint-plugin-i"), 1);
|
|
113
114
|
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
114
|
-
var
|
|
115
|
+
var pluginJsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
115
116
|
var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
|
|
116
117
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
117
118
|
var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
|
|
118
119
|
var import_eslint_plugin2 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
119
120
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
120
121
|
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
121
|
-
var
|
|
122
|
-
var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
|
|
122
|
+
var pluginYaml = __toESM(require("eslint-plugin-yml"), 1);
|
|
123
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);
|
|
124
126
|
var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
|
|
125
127
|
var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
|
|
126
128
|
var import_eslint_plugin_astro = __toESM(require("eslint-plugin-astro"), 1);
|
|
127
|
-
var
|
|
129
|
+
var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
|
|
128
130
|
var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
|
|
129
131
|
var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
|
|
130
132
|
var import_jsonc_eslint_parser = __toESM(require("jsonc-eslint-parser"), 1);
|
|
@@ -134,6 +136,7 @@ var import_astro_eslint_parser = __toESM(require("astro-eslint-parser"), 1);
|
|
|
134
136
|
function comments() {
|
|
135
137
|
return [
|
|
136
138
|
{
|
|
139
|
+
name: "coderwyd:eslint-comments",
|
|
137
140
|
plugins: {
|
|
138
141
|
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
139
142
|
},
|
|
@@ -170,7 +173,9 @@ var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
|
170
173
|
var GLOB_TESTS = [
|
|
171
174
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
172
175
|
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
173
|
-
`**/*.test.${GLOB_SRC_EXT}
|
|
176
|
+
`**/*.test.${GLOB_SRC_EXT}`,
|
|
177
|
+
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
178
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
174
179
|
];
|
|
175
180
|
var GLOB_ALL_SRC = [
|
|
176
181
|
GLOB_SRC,
|
|
@@ -188,6 +193,7 @@ var GLOB_EXCLUDE = [
|
|
|
188
193
|
"**/package-lock.json",
|
|
189
194
|
"**/yarn.lock",
|
|
190
195
|
"**/pnpm-lock.yaml",
|
|
196
|
+
"**/bun.lockb",
|
|
191
197
|
"**/output",
|
|
192
198
|
"**/coverage",
|
|
193
199
|
"**/temp",
|
|
@@ -196,6 +202,7 @@ var GLOB_EXCLUDE = [
|
|
|
196
202
|
"**/.vercel",
|
|
197
203
|
"**/.changeset",
|
|
198
204
|
"**/.idea",
|
|
205
|
+
"**/.cache",
|
|
199
206
|
"**/.output",
|
|
200
207
|
"**/.vite-inspect",
|
|
201
208
|
"**/CHANGELOG*.md",
|
|
@@ -209,7 +216,9 @@ var GLOB_EXCLUDE = [
|
|
|
209
216
|
// src/configs/ignores.ts
|
|
210
217
|
function ignores() {
|
|
211
218
|
return [
|
|
212
|
-
{
|
|
219
|
+
{
|
|
220
|
+
ignores: GLOB_EXCLUDE
|
|
221
|
+
}
|
|
213
222
|
];
|
|
214
223
|
}
|
|
215
224
|
|
|
@@ -220,14 +229,14 @@ function imports(options = {}) {
|
|
|
220
229
|
} = options;
|
|
221
230
|
return [
|
|
222
231
|
{
|
|
232
|
+
name: "coderwyd:imports",
|
|
223
233
|
plugins: {
|
|
224
234
|
antfu: import_eslint_plugin_antfu.default,
|
|
225
|
-
import:
|
|
235
|
+
import: pluginImport
|
|
226
236
|
},
|
|
227
237
|
rules: {
|
|
228
238
|
"antfu/import-dedupe": "error",
|
|
229
239
|
"antfu/no-import-node-modules-by-path": "error",
|
|
230
|
-
"import/export": "error",
|
|
231
240
|
"import/first": "error",
|
|
232
241
|
"import/no-duplicates": "error",
|
|
233
242
|
"import/no-mutable-exports": "error",
|
|
@@ -256,12 +265,6 @@ function javascript(options = {}) {
|
|
|
256
265
|
overrides = {}
|
|
257
266
|
} = options;
|
|
258
267
|
return [
|
|
259
|
-
{
|
|
260
|
-
plugins: {
|
|
261
|
-
"antfu": import_eslint_plugin_antfu.default,
|
|
262
|
-
"unused-imports": import_eslint_plugin_unused_imports.default
|
|
263
|
-
}
|
|
264
|
-
},
|
|
265
268
|
{
|
|
266
269
|
languageOptions: {
|
|
267
270
|
ecmaVersion: 2022,
|
|
@@ -282,20 +285,21 @@ function javascript(options = {}) {
|
|
|
282
285
|
},
|
|
283
286
|
sourceType: "module"
|
|
284
287
|
},
|
|
288
|
+
name: "coderwyd:javascript",
|
|
289
|
+
plugins: {
|
|
290
|
+
"antfu": import_eslint_plugin_antfu.default,
|
|
291
|
+
"unused-imports": import_eslint_plugin_unused_imports.default
|
|
292
|
+
},
|
|
285
293
|
rules: {
|
|
286
294
|
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
287
|
-
"antfu/top-level-function": "error",
|
|
288
295
|
"array-callback-return": "error",
|
|
289
296
|
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
290
297
|
"block-scoped-var": "error",
|
|
291
298
|
"constructor-super": "error",
|
|
292
299
|
"default-case-last": "error",
|
|
293
300
|
"dot-notation": ["error", { allowKeywords: true }],
|
|
294
|
-
"eol-last": "error",
|
|
295
301
|
"eqeqeq": ["error", "smart"],
|
|
296
|
-
"max-statements-per-line": ["error", { max: 1 }],
|
|
297
302
|
"new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
|
|
298
|
-
"new-parens": "error",
|
|
299
303
|
"no-alert": "error",
|
|
300
304
|
"no-array-constructor": "error",
|
|
301
305
|
"no-async-promise-executor": "error",
|
|
@@ -306,7 +310,6 @@ function javascript(options = {}) {
|
|
|
306
310
|
"no-cond-assign": ["error", "always"],
|
|
307
311
|
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
308
312
|
"no-const-assign": "error",
|
|
309
|
-
"no-constant-condition": "warn",
|
|
310
313
|
"no-control-regex": "error",
|
|
311
314
|
"no-debugger": "error",
|
|
312
315
|
"no-delete-var": "error",
|
|
@@ -322,9 +325,7 @@ function javascript(options = {}) {
|
|
|
322
325
|
"no-extend-native": "error",
|
|
323
326
|
"no-extra-bind": "error",
|
|
324
327
|
"no-extra-boolean-cast": "error",
|
|
325
|
-
"no-extra-parens": ["error", "functions"],
|
|
326
328
|
"no-fallthrough": "error",
|
|
327
|
-
"no-floating-decimal": "error",
|
|
328
329
|
"no-func-assign": "error",
|
|
329
330
|
"no-global-assign": "error",
|
|
330
331
|
"no-implied-eval": "error",
|
|
@@ -337,14 +338,6 @@ function javascript(options = {}) {
|
|
|
337
338
|
"no-lone-blocks": "error",
|
|
338
339
|
"no-loss-of-precision": "error",
|
|
339
340
|
"no-misleading-character-class": "error",
|
|
340
|
-
"no-mixed-operators": ["error", {
|
|
341
|
-
allowSamePrecedence: true,
|
|
342
|
-
groups: [
|
|
343
|
-
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
|
344
|
-
["&&", "||"],
|
|
345
|
-
["in", "instanceof"]
|
|
346
|
-
]
|
|
347
|
-
}],
|
|
348
341
|
"no-multi-str": "error",
|
|
349
342
|
"no-new": "error",
|
|
350
343
|
"no-new-func": "error",
|
|
@@ -375,7 +368,9 @@ function javascript(options = {}) {
|
|
|
375
368
|
"error",
|
|
376
369
|
"DebuggerStatement",
|
|
377
370
|
"LabeledStatement",
|
|
378
|
-
"WithStatement"
|
|
371
|
+
"WithStatement",
|
|
372
|
+
"TSEnumDeclaration[const=true]",
|
|
373
|
+
"TSExportAssignment"
|
|
379
374
|
],
|
|
380
375
|
"no-self-assign": ["error", { props: true }],
|
|
381
376
|
"no-self-compare": "error",
|
|
@@ -445,7 +440,6 @@ function javascript(options = {}) {
|
|
|
445
440
|
"prefer-rest-params": "error",
|
|
446
441
|
"prefer-spread": "error",
|
|
447
442
|
"prefer-template": "error",
|
|
448
|
-
"quote-props": ["error", "consistent-as-needed"],
|
|
449
443
|
"sort-imports": [
|
|
450
444
|
"error",
|
|
451
445
|
{
|
|
@@ -466,13 +460,13 @@ function javascript(options = {}) {
|
|
|
466
460
|
"use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
|
|
467
461
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
468
462
|
"vars-on-top": "error",
|
|
469
|
-
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
470
463
|
"yoda": ["error", "never"],
|
|
471
464
|
...overrides
|
|
472
465
|
}
|
|
473
466
|
},
|
|
474
467
|
{
|
|
475
468
|
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
469
|
+
name: "coderwyd:scripts-overrides",
|
|
476
470
|
rules: {
|
|
477
471
|
"no-console": OFF
|
|
478
472
|
}
|
|
@@ -487,11 +481,10 @@ function jsdoc(options = {}) {
|
|
|
487
481
|
} = options;
|
|
488
482
|
return [
|
|
489
483
|
{
|
|
484
|
+
name: "coderwyd:jsdoc",
|
|
490
485
|
plugins: {
|
|
491
486
|
jsdoc: import_eslint_plugin_jsdoc.default
|
|
492
|
-
}
|
|
493
|
-
},
|
|
494
|
-
{
|
|
487
|
+
},
|
|
495
488
|
rules: {
|
|
496
489
|
"jsdoc/check-access": "warn",
|
|
497
490
|
"jsdoc/check-param-names": "warn",
|
|
@@ -508,7 +501,6 @@ function jsdoc(options = {}) {
|
|
|
508
501
|
"jsdoc/require-returns-check": "warn",
|
|
509
502
|
"jsdoc/require-returns-description": "warn",
|
|
510
503
|
"jsdoc/require-yields-check": "warn",
|
|
511
|
-
"jsdoc/valid-types": "warn",
|
|
512
504
|
...stylistic2 ? {
|
|
513
505
|
"jsdoc/check-alignment": "warn",
|
|
514
506
|
"jsdoc/multiline-blocks": "warn"
|
|
@@ -524,10 +516,14 @@ function jsonc(options = {}) {
|
|
|
524
516
|
stylistic: stylistic2 = true,
|
|
525
517
|
overrides = {}
|
|
526
518
|
} = options;
|
|
519
|
+
const {
|
|
520
|
+
indent = 2
|
|
521
|
+
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
527
522
|
return [
|
|
528
523
|
{
|
|
524
|
+
name: "coderwyd:jsonc:setup",
|
|
529
525
|
plugins: {
|
|
530
|
-
jsonc:
|
|
526
|
+
jsonc: pluginJsonc
|
|
531
527
|
}
|
|
532
528
|
},
|
|
533
529
|
{
|
|
@@ -535,6 +531,7 @@ function jsonc(options = {}) {
|
|
|
535
531
|
languageOptions: {
|
|
536
532
|
parser: import_jsonc_eslint_parser.default
|
|
537
533
|
},
|
|
534
|
+
name: "coderwyd:jsonc:rules",
|
|
538
535
|
rules: {
|
|
539
536
|
"jsonc/no-bigint-literals": "error",
|
|
540
537
|
"jsonc/no-binary-expression": "error",
|
|
@@ -566,7 +563,7 @@ function jsonc(options = {}) {
|
|
|
566
563
|
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
567
564
|
"jsonc/comma-dangle": ["error", "never"],
|
|
568
565
|
"jsonc/comma-style": ["error", "last"],
|
|
569
|
-
"jsonc/indent": ["error",
|
|
566
|
+
"jsonc/indent": ["error", indent],
|
|
570
567
|
"jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
571
568
|
"jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
572
569
|
"jsonc/object-curly-spacing": ["error", "always"],
|
|
@@ -588,12 +585,14 @@ function markdown(options = {}) {
|
|
|
588
585
|
} = options;
|
|
589
586
|
return [
|
|
590
587
|
{
|
|
588
|
+
name: "coderwyd:markdown:setup",
|
|
591
589
|
plugins: {
|
|
592
590
|
markdown: import_eslint_plugin_markdown.default
|
|
593
591
|
}
|
|
594
592
|
},
|
|
595
593
|
{
|
|
596
594
|
files: [GLOB_MARKDOWN],
|
|
595
|
+
name: "coderwyd:markdown:processor",
|
|
597
596
|
processor: "markdown/markdown"
|
|
598
597
|
},
|
|
599
598
|
{
|
|
@@ -608,10 +607,10 @@ function markdown(options = {}) {
|
|
|
608
607
|
}
|
|
609
608
|
}
|
|
610
609
|
},
|
|
610
|
+
name: "coderwyd:markdown:rules",
|
|
611
611
|
rules: {
|
|
612
612
|
"antfu/no-cjs-exports": OFF,
|
|
613
613
|
"antfu/no-ts-export-equal": OFF,
|
|
614
|
-
"eol-last": OFF,
|
|
615
614
|
"no-alert": OFF,
|
|
616
615
|
"no-console": OFF,
|
|
617
616
|
"no-undef": OFF,
|
|
@@ -619,6 +618,7 @@ function markdown(options = {}) {
|
|
|
619
618
|
"no-unused-vars": OFF,
|
|
620
619
|
"node/prefer-global/process": OFF,
|
|
621
620
|
"style/comma-dangle": OFF,
|
|
621
|
+
"style/eol-last": OFF,
|
|
622
622
|
"ts/consistent-type-imports": OFF,
|
|
623
623
|
"ts/no-namespace": OFF,
|
|
624
624
|
"ts/no-redeclare": OFF,
|
|
@@ -658,6 +658,7 @@ function markdown(options = {}) {
|
|
|
658
658
|
function node() {
|
|
659
659
|
return [
|
|
660
660
|
{
|
|
661
|
+
name: "coderwyd:node",
|
|
661
662
|
plugins: {
|
|
662
663
|
node: import_eslint_plugin_n.default
|
|
663
664
|
},
|
|
@@ -680,6 +681,7 @@ function sortPackageJson() {
|
|
|
680
681
|
return [
|
|
681
682
|
{
|
|
682
683
|
files: ["**/package.json"],
|
|
684
|
+
name: "coderwyd:sort-package-json",
|
|
683
685
|
rules: {
|
|
684
686
|
"jsonc/sort-array-values": [
|
|
685
687
|
"error",
|
|
@@ -769,6 +771,7 @@ function sortTsconfig() {
|
|
|
769
771
|
return [
|
|
770
772
|
{
|
|
771
773
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
774
|
+
name: "coderwyd:sort-tsconfig",
|
|
772
775
|
rules: {
|
|
773
776
|
"jsonc/sort-keys": [
|
|
774
777
|
"error",
|
|
@@ -794,70 +797,39 @@ function sortTsconfig() {
|
|
|
794
797
|
"disableReferencedProjectLoad",
|
|
795
798
|
/* Language and Environment */
|
|
796
799
|
"target",
|
|
797
|
-
"lib",
|
|
798
800
|
"jsx",
|
|
799
|
-
"experimentalDecorators",
|
|
800
|
-
"emitDecoratorMetadata",
|
|
801
801
|
"jsxFactory",
|
|
802
802
|
"jsxFragmentFactory",
|
|
803
803
|
"jsxImportSource",
|
|
804
|
-
"
|
|
804
|
+
"lib",
|
|
805
|
+
"moduleDetection",
|
|
805
806
|
"noLib",
|
|
807
|
+
"reactNamespace",
|
|
806
808
|
"useDefineForClassFields",
|
|
807
|
-
"
|
|
809
|
+
"emitDecoratorMetadata",
|
|
810
|
+
"experimentalDecorators",
|
|
808
811
|
/* Modules */
|
|
809
|
-
"module",
|
|
810
|
-
"rootDir",
|
|
811
|
-
"moduleResolution",
|
|
812
812
|
"baseUrl",
|
|
813
|
-
"
|
|
813
|
+
"rootDir",
|
|
814
814
|
"rootDirs",
|
|
815
|
-
"
|
|
816
|
-
"
|
|
817
|
-
"
|
|
815
|
+
"customConditions",
|
|
816
|
+
"module",
|
|
817
|
+
"moduleResolution",
|
|
818
818
|
"moduleSuffixes",
|
|
819
|
-
"
|
|
819
|
+
"noResolve",
|
|
820
|
+
"paths",
|
|
821
|
+
"resolveJsonModule",
|
|
820
822
|
"resolvePackageJsonExports",
|
|
821
823
|
"resolvePackageJsonImports",
|
|
822
|
-
"
|
|
823
|
-
"
|
|
824
|
+
"typeRoots",
|
|
825
|
+
"types",
|
|
824
826
|
"allowArbitraryExtensions",
|
|
825
|
-
"
|
|
827
|
+
"allowImportingTsExtensions",
|
|
828
|
+
"allowUmdGlobalAccess",
|
|
826
829
|
/* JavaScript Support */
|
|
827
830
|
"allowJs",
|
|
828
831
|
"checkJs",
|
|
829
832
|
"maxNodeModuleJsDepth",
|
|
830
|
-
/* Emit */
|
|
831
|
-
"declaration",
|
|
832
|
-
"declarationMap",
|
|
833
|
-
"emitDeclarationOnly",
|
|
834
|
-
"sourceMap",
|
|
835
|
-
"inlineSourceMap",
|
|
836
|
-
"outFile",
|
|
837
|
-
"outDir",
|
|
838
|
-
"removeComments",
|
|
839
|
-
"noEmit",
|
|
840
|
-
"importHelpers",
|
|
841
|
-
"importsNotUsedAsValues",
|
|
842
|
-
"downlevelIteration",
|
|
843
|
-
"sourceRoot",
|
|
844
|
-
"mapRoot",
|
|
845
|
-
"inlineSources",
|
|
846
|
-
"emitBOM",
|
|
847
|
-
"newLine",
|
|
848
|
-
"stripInternal",
|
|
849
|
-
"noEmitHelpers",
|
|
850
|
-
"noEmitOnError",
|
|
851
|
-
"preserveConstEnums",
|
|
852
|
-
"declarationDir",
|
|
853
|
-
"preserveValueImports",
|
|
854
|
-
/* Interop Constraints */
|
|
855
|
-
"isolatedModules",
|
|
856
|
-
"verbatimModuleSyntax",
|
|
857
|
-
"allowSyntheticDefaultImports",
|
|
858
|
-
"esModuleInterop",
|
|
859
|
-
"preserveSymlinks",
|
|
860
|
-
"forceConsistentCasingInFileNames",
|
|
861
833
|
/* Type Checking */
|
|
862
834
|
"strict",
|
|
863
835
|
"strictBindCallApply",
|
|
@@ -878,6 +850,37 @@ function sortTsconfig() {
|
|
|
878
850
|
"noUnusedLocals",
|
|
879
851
|
"noUnusedParameters",
|
|
880
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",
|
|
881
884
|
/* Completeness */
|
|
882
885
|
"skipDefaultLibCheck",
|
|
883
886
|
"skipLibCheck"
|
|
@@ -891,9 +894,14 @@ function sortTsconfig() {
|
|
|
891
894
|
}
|
|
892
895
|
|
|
893
896
|
// src/configs/stylistic.ts
|
|
894
|
-
function stylistic() {
|
|
897
|
+
function stylistic(options = {}) {
|
|
898
|
+
const {
|
|
899
|
+
indent = 2,
|
|
900
|
+
quotes = "single"
|
|
901
|
+
} = options;
|
|
895
902
|
return [
|
|
896
903
|
{
|
|
904
|
+
name: "coderwyd:stylistic",
|
|
897
905
|
plugins: {
|
|
898
906
|
antfu: import_eslint_plugin_antfu.default,
|
|
899
907
|
style: import_eslint_plugin.default
|
|
@@ -901,6 +909,7 @@ function stylistic() {
|
|
|
901
909
|
rules: {
|
|
902
910
|
"antfu/consistent-list-newline": "error",
|
|
903
911
|
"antfu/if-newline": "error",
|
|
912
|
+
"antfu/top-level-function": "error",
|
|
904
913
|
"curly": ["error", "multi-or-nest", "consistent"],
|
|
905
914
|
"style/array-bracket-spacing": ["error", "never"],
|
|
906
915
|
"style/arrow-spacing": ["error", { after: true, before: true }],
|
|
@@ -911,7 +920,8 @@ function stylistic() {
|
|
|
911
920
|
"style/comma-style": ["error", "last"],
|
|
912
921
|
"style/computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
|
|
913
922
|
"style/dot-location": ["error", "property"],
|
|
914
|
-
"style/
|
|
923
|
+
"style/eol-last": "error",
|
|
924
|
+
"style/indent": ["error", indent, {
|
|
915
925
|
ArrayExpression: 1,
|
|
916
926
|
CallExpression: { arguments: 1 },
|
|
917
927
|
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
@@ -949,22 +959,36 @@ function stylistic() {
|
|
|
949
959
|
offsetTernaryExpressions: true,
|
|
950
960
|
outerIIFEBody: 1
|
|
951
961
|
}],
|
|
962
|
+
"style/jsx-quotes": "error",
|
|
952
963
|
"style/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
953
964
|
"style/keyword-spacing": ["error", { after: true, before: true }],
|
|
954
965
|
"style/lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
|
|
966
|
+
"style/max-statements-per-line": ["error", { max: 1 }],
|
|
955
967
|
"style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
956
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
|
+
}],
|
|
957
980
|
"style/no-mixed-spaces-and-tabs": "error",
|
|
958
981
|
"style/no-multi-spaces": "error",
|
|
959
982
|
"style/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
960
|
-
"style/no-tabs": "error",
|
|
983
|
+
"style/no-tabs": indent === "tab" ? "off" : "error",
|
|
961
984
|
"style/no-trailing-spaces": "error",
|
|
962
985
|
"style/no-whitespace-before-property": "error",
|
|
963
986
|
"style/object-curly-spacing": ["error", "always"],
|
|
964
987
|
"style/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
965
988
|
"style/operator-linebreak": ["error", "before"],
|
|
966
989
|
"style/padded-blocks": ["error", { blocks: "never", classes: "never", switches: "never" }],
|
|
967
|
-
"style/
|
|
990
|
+
"style/quote-props": ["error", "consistent-as-needed"],
|
|
991
|
+
"style/quotes": ["error", quotes, { allowTemplateLiterals: true, avoidEscape: false }],
|
|
968
992
|
"style/rest-spread-spacing": ["error", "never"],
|
|
969
993
|
"style/semi": ["error", "never"],
|
|
970
994
|
"style/semi-spacing": ["error", { after: true, before: false }],
|
|
@@ -987,6 +1011,7 @@ function stylistic() {
|
|
|
987
1011
|
"style/template-curly-spacing": "error",
|
|
988
1012
|
"style/template-tag-spacing": ["error", "never"],
|
|
989
1013
|
"style/type-annotation-spacing": ["error", {}],
|
|
1014
|
+
"style/wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
990
1015
|
"style/yield-star-spacing": ["error", "both"]
|
|
991
1016
|
}
|
|
992
1017
|
}
|
|
@@ -1023,6 +1048,7 @@ function typescript(options) {
|
|
|
1023
1048
|
"no-implied-eval": OFF,
|
|
1024
1049
|
"no-throw-literal": OFF,
|
|
1025
1050
|
"ts/await-thenable": "error",
|
|
1051
|
+
"ts/ban-types": ["error", { types: { Function: false } }],
|
|
1026
1052
|
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
1027
1053
|
"ts/no-floating-promises": "error",
|
|
1028
1054
|
"ts/no-for-in-array": "error",
|
|
@@ -1041,20 +1067,20 @@ function typescript(options) {
|
|
|
1041
1067
|
};
|
|
1042
1068
|
return [
|
|
1043
1069
|
{
|
|
1070
|
+
name: "coderwyd:typescript:setup",
|
|
1044
1071
|
plugins: {
|
|
1045
1072
|
antfu: import_eslint_plugin_antfu.default,
|
|
1046
|
-
import:
|
|
1073
|
+
import: pluginImport,
|
|
1047
1074
|
ts: import_eslint_plugin2.default
|
|
1048
1075
|
}
|
|
1049
1076
|
},
|
|
1050
1077
|
{
|
|
1051
1078
|
files: [
|
|
1052
|
-
|
|
1053
|
-
GLOB_TSX,
|
|
1079
|
+
GLOB_SRC,
|
|
1054
1080
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1055
1081
|
],
|
|
1056
1082
|
languageOptions: {
|
|
1057
|
-
parser:
|
|
1083
|
+
parser: parserTs,
|
|
1058
1084
|
parserOptions: {
|
|
1059
1085
|
sourceType: "module",
|
|
1060
1086
|
...tsconfigPath ? {
|
|
@@ -1064,6 +1090,7 @@ function typescript(options) {
|
|
|
1064
1090
|
...parserOptions
|
|
1065
1091
|
}
|
|
1066
1092
|
},
|
|
1093
|
+
name: "coderwyd:typescript:rules",
|
|
1067
1094
|
rules: {
|
|
1068
1095
|
...renameRules(
|
|
1069
1096
|
import_eslint_plugin2.default.configs["eslint-recommended"].overrides[0].rules,
|
|
@@ -1078,10 +1105,7 @@ function typescript(options) {
|
|
|
1078
1105
|
"antfu/generic-spacing": "error",
|
|
1079
1106
|
"antfu/named-tuple-spacing": "error",
|
|
1080
1107
|
"antfu/no-cjs-exports": "error",
|
|
1081
|
-
"antfu/no-const-enum": "error",
|
|
1082
|
-
"antfu/no-ts-export-equal": "error",
|
|
1083
1108
|
"no-dupe-class-members": OFF,
|
|
1084
|
-
"no-extra-parens": OFF,
|
|
1085
1109
|
"no-invalid-this": OFF,
|
|
1086
1110
|
"no-loss-of-precision": OFF,
|
|
1087
1111
|
"no-redeclare": OFF,
|
|
@@ -1094,7 +1118,7 @@ function typescript(options) {
|
|
|
1094
1118
|
"ts/no-dupe-class-members": "error",
|
|
1095
1119
|
"ts/no-dynamic-delete": OFF,
|
|
1096
1120
|
"ts/no-explicit-any": OFF,
|
|
1097
|
-
"ts/no-
|
|
1121
|
+
"ts/no-extraneous-class": OFF,
|
|
1098
1122
|
"ts/no-invalid-this": "error",
|
|
1099
1123
|
"ts/no-invalid-void-type": OFF,
|
|
1100
1124
|
"ts/no-loss-of-precision": "error",
|
|
@@ -1103,28 +1127,34 @@ function typescript(options) {
|
|
|
1103
1127
|
"ts/no-require-imports": "error",
|
|
1104
1128
|
"ts/no-unused-vars": OFF,
|
|
1105
1129
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
1130
|
+
"ts/no-useless-constructor": OFF,
|
|
1106
1131
|
"ts/prefer-ts-expect-error": "error",
|
|
1107
1132
|
"ts/triple-slash-reference": OFF,
|
|
1133
|
+
"ts/unified-signatures": OFF,
|
|
1108
1134
|
...tsconfigPath ? typeAwareRules : {},
|
|
1109
1135
|
...overrides
|
|
1110
1136
|
}
|
|
1111
1137
|
},
|
|
1112
1138
|
{
|
|
1113
1139
|
files: ["**/*.d.ts"],
|
|
1140
|
+
name: "coderwyd:typescript:dts-overrides",
|
|
1114
1141
|
rules: {
|
|
1115
1142
|
"eslint-comments/no-unlimited-disable": OFF,
|
|
1116
1143
|
"import/no-duplicates": OFF,
|
|
1144
|
+
"no-restricted-syntax": OFF,
|
|
1117
1145
|
"unused-imports/no-unused-vars": OFF
|
|
1118
1146
|
}
|
|
1119
1147
|
},
|
|
1120
1148
|
{
|
|
1121
1149
|
files: GLOB_TESTS,
|
|
1150
|
+
name: "coderwyd:typescript:tests-overrides",
|
|
1122
1151
|
rules: {
|
|
1123
1152
|
"no-unused-expressions": OFF
|
|
1124
1153
|
}
|
|
1125
1154
|
},
|
|
1126
1155
|
{
|
|
1127
|
-
files: [
|
|
1156
|
+
files: [GLOB_JS],
|
|
1157
|
+
name: "coderwyd:typescript:javascript-overrides",
|
|
1128
1158
|
rules: {
|
|
1129
1159
|
"ts/no-require-imports": OFF,
|
|
1130
1160
|
"ts/no-var-requires": OFF
|
|
@@ -1137,11 +1167,10 @@ function typescript(options) {
|
|
|
1137
1167
|
function unicorn() {
|
|
1138
1168
|
return [
|
|
1139
1169
|
{
|
|
1170
|
+
name: "coderwyd:unicorn",
|
|
1140
1171
|
plugins: {
|
|
1141
1172
|
unicorn: import_eslint_plugin_unicorn.default
|
|
1142
|
-
}
|
|
1143
|
-
},
|
|
1144
|
-
{
|
|
1173
|
+
},
|
|
1145
1174
|
rules: {
|
|
1146
1175
|
// Pass error message when throwing errors
|
|
1147
1176
|
"unicorn/error-message": "error",
|
|
@@ -1153,10 +1182,10 @@ function unicorn() {
|
|
|
1153
1182
|
"unicorn/no-new-array": "error",
|
|
1154
1183
|
// Prevent deprecated `new Buffer()`
|
|
1155
1184
|
"unicorn/no-new-buffer": "error",
|
|
1156
|
-
// Keep regex literals safe!
|
|
1157
|
-
"unicorn/no-unsafe-regex": "error",
|
|
1158
1185
|
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
1159
1186
|
"unicorn/number-literal-case": "error",
|
|
1187
|
+
// textContent instead of innerText
|
|
1188
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
1160
1189
|
// includes over indexOf when checking for existence
|
|
1161
1190
|
"unicorn/prefer-includes": "error",
|
|
1162
1191
|
// Prefer using the node: protocol
|
|
@@ -1165,8 +1194,6 @@ function unicorn() {
|
|
|
1165
1194
|
"unicorn/prefer-number-properties": "error",
|
|
1166
1195
|
// String methods startsWith/endsWith instead of more complicated stuff
|
|
1167
1196
|
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1168
|
-
// textContent instead of innerText
|
|
1169
|
-
"unicorn/prefer-text-content": "error",
|
|
1170
1197
|
// Enforce throwing type error when throwing error while checking typeof
|
|
1171
1198
|
"unicorn/prefer-type-error": "error",
|
|
1172
1199
|
// Use new when throwing error
|
|
@@ -1203,8 +1230,12 @@ function vue(options = {}) {
|
|
|
1203
1230
|
overrides = {},
|
|
1204
1231
|
stylistic: stylistic2 = true
|
|
1205
1232
|
} = options;
|
|
1233
|
+
const {
|
|
1234
|
+
indent = 2
|
|
1235
|
+
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1206
1236
|
return [
|
|
1207
1237
|
{
|
|
1238
|
+
name: "coderwyd:vue:setup",
|
|
1208
1239
|
plugins: {
|
|
1209
1240
|
vue: import_eslint_plugin_vue.default
|
|
1210
1241
|
}
|
|
@@ -1218,10 +1249,11 @@ function vue(options = {}) {
|
|
|
1218
1249
|
jsx: true
|
|
1219
1250
|
},
|
|
1220
1251
|
extraFileExtensions: [".vue"],
|
|
1221
|
-
parser: options.typescript ?
|
|
1252
|
+
parser: options.typescript ? parserTs : null,
|
|
1222
1253
|
sourceType: "module"
|
|
1223
1254
|
}
|
|
1224
1255
|
},
|
|
1256
|
+
name: "coderwyd:vue:rules",
|
|
1225
1257
|
processor: import_eslint_plugin_vue.default.processors[".vue"],
|
|
1226
1258
|
rules: {
|
|
1227
1259
|
...isVue3 ? vue3Rules : vue2Rules,
|
|
@@ -1238,6 +1270,8 @@ function vue(options = {}) {
|
|
|
1238
1270
|
"vue/dot-location": ["error", "property"],
|
|
1239
1271
|
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1240
1272
|
"vue/eqeqeq": ["error", "smart"],
|
|
1273
|
+
"vue/html-indent": ["error", indent],
|
|
1274
|
+
"vue/html-quotes": ["error", "double"],
|
|
1241
1275
|
"vue/max-attributes-per-line": OFF,
|
|
1242
1276
|
"vue/multi-word-component-names": OFF,
|
|
1243
1277
|
"vue/no-dupe-keys": OFF,
|
|
@@ -1309,10 +1343,15 @@ function yaml(options = {}) {
|
|
|
1309
1343
|
overrides = {},
|
|
1310
1344
|
stylistic: stylistic2 = true
|
|
1311
1345
|
} = options;
|
|
1346
|
+
const {
|
|
1347
|
+
indent = 2,
|
|
1348
|
+
quotes = "single"
|
|
1349
|
+
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1312
1350
|
return [
|
|
1313
1351
|
{
|
|
1352
|
+
name: "coderwyd:yaml:setup",
|
|
1314
1353
|
plugins: {
|
|
1315
|
-
yaml:
|
|
1354
|
+
yaml: pluginYaml
|
|
1316
1355
|
}
|
|
1317
1356
|
},
|
|
1318
1357
|
{
|
|
@@ -1320,6 +1359,7 @@ function yaml(options = {}) {
|
|
|
1320
1359
|
languageOptions: {
|
|
1321
1360
|
parser: import_yaml_eslint_parser.default
|
|
1322
1361
|
},
|
|
1362
|
+
name: "coderwyd:yaml:rules",
|
|
1323
1363
|
rules: {
|
|
1324
1364
|
"style/spaced-comment": OFF,
|
|
1325
1365
|
"yaml/block-mapping": "error",
|
|
@@ -1336,10 +1376,10 @@ function yaml(options = {}) {
|
|
|
1336
1376
|
"yaml/flow-mapping-curly-spacing": "error",
|
|
1337
1377
|
"yaml/flow-sequence-bracket-newline": "error",
|
|
1338
1378
|
"yaml/flow-sequence-bracket-spacing": "error",
|
|
1339
|
-
"yaml/indent": ["error", 2],
|
|
1379
|
+
"yaml/indent": ["error", indent === "tab" ? 2 : indent],
|
|
1340
1380
|
"yaml/key-spacing": "error",
|
|
1341
1381
|
"yaml/no-tab-indent": "error",
|
|
1342
|
-
"yaml/quotes": ["error", { avoidEscape: false, prefer:
|
|
1382
|
+
"yaml/quotes": ["error", { avoidEscape: false, prefer: quotes }],
|
|
1343
1383
|
"yaml/spaced-comment": "error"
|
|
1344
1384
|
} : {},
|
|
1345
1385
|
...overrides
|
|
@@ -1354,53 +1394,214 @@ function test(options = {}) {
|
|
|
1354
1394
|
isInEditor = false,
|
|
1355
1395
|
overrides = {}
|
|
1356
1396
|
} = options;
|
|
1357
|
-
return [
|
|
1358
|
-
|
|
1359
|
-
"
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1397
|
+
return [
|
|
1398
|
+
{
|
|
1399
|
+
name: "coderwyd:test:setup",
|
|
1400
|
+
plugins: {
|
|
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",
|
|
1414
|
+
rules: {
|
|
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
|
|
1421
|
+
}
|
|
1366
1422
|
}
|
|
1367
|
-
|
|
1423
|
+
];
|
|
1368
1424
|
}
|
|
1369
1425
|
|
|
1370
1426
|
// src/configs/react.ts
|
|
1427
|
+
var import_globals2 = __toESM(require("globals"), 1);
|
|
1371
1428
|
function react(options = {}) {
|
|
1372
1429
|
const {
|
|
1373
|
-
overrides = {}
|
|
1430
|
+
overrides = {},
|
|
1431
|
+
stylistic: stylistic2 = true
|
|
1374
1432
|
} = options;
|
|
1433
|
+
const {
|
|
1434
|
+
indent = 2
|
|
1435
|
+
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1436
|
+
const extensions = [GLOB_JSX, ...[options.typescript ? GLOB_TSX : ""]];
|
|
1375
1437
|
return [
|
|
1376
1438
|
{
|
|
1439
|
+
name: "coderwyd:react:setup",
|
|
1377
1440
|
plugins: {
|
|
1378
1441
|
"react": import_eslint_plugin_react.default,
|
|
1379
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
|
+
}
|
|
1380
1452
|
}
|
|
1381
1453
|
},
|
|
1382
1454
|
{
|
|
1383
|
-
files: [GLOB_JSX, GLOB_TSX],
|
|
1455
|
+
files: [GLOB_JSX, ...[options.typescript ? GLOB_TSX : ""]],
|
|
1384
1456
|
languageOptions: {
|
|
1457
|
+
globals: import_globals2.default.browser,
|
|
1385
1458
|
parserOptions: {
|
|
1386
1459
|
ecmaFeatures: {
|
|
1387
1460
|
jsx: true
|
|
1388
1461
|
},
|
|
1389
|
-
|
|
1390
|
-
|
|
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
|
|
1391
1468
|
}
|
|
1392
1469
|
},
|
|
1470
|
+
name: "coderwyd:react:rules",
|
|
1393
1471
|
rules: {
|
|
1394
|
-
"jsx-quotes": ["error", "prefer-double"],
|
|
1395
1472
|
...import_eslint_plugin_react.default.configs.recommended.rules,
|
|
1396
|
-
"react/react-in-jsx-scope": OFF,
|
|
1397
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
|
+
} : {},
|
|
1398
1604
|
...overrides
|
|
1399
|
-
},
|
|
1400
|
-
settings: {
|
|
1401
|
-
react: {
|
|
1402
|
-
version: "detect"
|
|
1403
|
-
}
|
|
1404
1605
|
}
|
|
1405
1606
|
}
|
|
1406
1607
|
];
|
|
@@ -1410,20 +1611,19 @@ function react(options = {}) {
|
|
|
1410
1611
|
function astro(options = {}) {
|
|
1411
1612
|
const { overrides = {} } = options;
|
|
1412
1613
|
return [
|
|
1413
|
-
{
|
|
1414
|
-
plugins: {
|
|
1415
|
-
astro: import_eslint_plugin_astro.default
|
|
1416
|
-
}
|
|
1417
|
-
},
|
|
1418
1614
|
{
|
|
1419
1615
|
files: [GLOB_ASTRO],
|
|
1420
1616
|
languageOptions: {
|
|
1421
1617
|
parser: import_astro_eslint_parser.default,
|
|
1422
1618
|
parserOptions: {
|
|
1423
1619
|
extraFileExtensions: [".astro"],
|
|
1424
|
-
parser: options.typescript ?
|
|
1620
|
+
parser: options.typescript ? parserTs : null
|
|
1425
1621
|
}
|
|
1426
1622
|
},
|
|
1623
|
+
name: "coderwyd:astro",
|
|
1624
|
+
plugins: {
|
|
1625
|
+
astro: import_eslint_plugin_astro.default
|
|
1626
|
+
},
|
|
1427
1627
|
rules: {
|
|
1428
1628
|
...import_eslint_plugin_astro.default.configs.recommended.rules,
|
|
1429
1629
|
...overrides
|
|
@@ -1499,8 +1699,11 @@ function coderwyd(options = {}, ...userConfigs) {
|
|
|
1499
1699
|
overrides: overrides.typescript
|
|
1500
1700
|
}));
|
|
1501
1701
|
}
|
|
1502
|
-
if (enableStylistic)
|
|
1503
|
-
configs.push(stylistic(
|
|
1702
|
+
if (enableStylistic) {
|
|
1703
|
+
configs.push(stylistic(
|
|
1704
|
+
typeof enableStylistic === "boolean" ? {} : enableStylistic
|
|
1705
|
+
));
|
|
1706
|
+
}
|
|
1504
1707
|
if (options.test ?? true)
|
|
1505
1708
|
configs.push(test({ isInEditor, overrides: overrides.test }));
|
|
1506
1709
|
if (enableVue) {
|
|
@@ -1609,6 +1812,7 @@ var src_default = coderwyd;
|
|
|
1609
1812
|
pluginTs,
|
|
1610
1813
|
pluginUnicorn,
|
|
1611
1814
|
pluginUnusedImports,
|
|
1815
|
+
pluginVitest,
|
|
1612
1816
|
pluginVue,
|
|
1613
1817
|
pluginYaml,
|
|
1614
1818
|
react,
|