@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.js
CHANGED
|
@@ -7,31 +7,33 @@ import gitignore from "eslint-config-flat-gitignore";
|
|
|
7
7
|
// src/plugins.ts
|
|
8
8
|
import { default as default2 } from "eslint-plugin-antfu";
|
|
9
9
|
import { default as default3 } from "eslint-plugin-eslint-comments";
|
|
10
|
-
import
|
|
11
|
-
import { default as
|
|
12
|
-
import
|
|
13
|
-
import { default as
|
|
14
|
-
import { default as
|
|
15
|
-
import { default as
|
|
16
|
-
import { default as
|
|
17
|
-
import { default as
|
|
18
|
-
import { default as
|
|
10
|
+
import * as pluginImport from "eslint-plugin-i";
|
|
11
|
+
import { default as default4 } from "eslint-plugin-jsdoc";
|
|
12
|
+
import * as pluginJsonc from "eslint-plugin-jsonc";
|
|
13
|
+
import { default as default5 } from "eslint-plugin-markdown";
|
|
14
|
+
import { default as default6 } from "eslint-plugin-n";
|
|
15
|
+
import { default as default7 } from "@stylistic/eslint-plugin";
|
|
16
|
+
import { default as default8 } from "@typescript-eslint/eslint-plugin";
|
|
17
|
+
import { default as default9 } from "eslint-plugin-unicorn";
|
|
18
|
+
import { default as default10 } from "eslint-plugin-unused-imports";
|
|
19
|
+
import * as pluginYaml from "eslint-plugin-yml";
|
|
20
|
+
import { default as default11 } from "eslint-plugin-no-only-tests";
|
|
21
|
+
import { default as default12 } from "eslint-plugin-vitest";
|
|
19
22
|
import { default as default13 } from "eslint-plugin-vue";
|
|
20
|
-
import { default as default14 } from "eslint-plugin-
|
|
21
|
-
import { default as default15 } from "eslint-plugin-
|
|
22
|
-
import { default as default16 } from "eslint-plugin-
|
|
23
|
-
import
|
|
24
|
-
import { default as
|
|
25
|
-
import { default as
|
|
26
|
-
import { default as
|
|
27
|
-
import { default as
|
|
28
|
-
import { default as default22 } from "jsonc-eslint-parser";
|
|
29
|
-
import { default as default23 } from "astro-eslint-parser";
|
|
23
|
+
import { default as default14 } from "eslint-plugin-react";
|
|
24
|
+
import { default as default15 } from "eslint-plugin-react-hooks";
|
|
25
|
+
import { default as default16 } from "eslint-plugin-astro";
|
|
26
|
+
import * as parserTs from "@typescript-eslint/parser";
|
|
27
|
+
import { default as default17 } from "vue-eslint-parser";
|
|
28
|
+
import { default as default18 } from "yaml-eslint-parser";
|
|
29
|
+
import { default as default19 } from "jsonc-eslint-parser";
|
|
30
|
+
import { default as default20 } from "astro-eslint-parser";
|
|
30
31
|
|
|
31
32
|
// src/configs/comments.ts
|
|
32
33
|
function comments() {
|
|
33
34
|
return [
|
|
34
35
|
{
|
|
36
|
+
name: "coderwyd:eslint-comments",
|
|
35
37
|
plugins: {
|
|
36
38
|
"eslint-comments": default3
|
|
37
39
|
},
|
|
@@ -68,7 +70,9 @@ var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
|
68
70
|
var GLOB_TESTS = [
|
|
69
71
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
70
72
|
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
71
|
-
`**/*.test.${GLOB_SRC_EXT}
|
|
73
|
+
`**/*.test.${GLOB_SRC_EXT}`,
|
|
74
|
+
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
75
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
72
76
|
];
|
|
73
77
|
var GLOB_ALL_SRC = [
|
|
74
78
|
GLOB_SRC,
|
|
@@ -86,6 +90,7 @@ var GLOB_EXCLUDE = [
|
|
|
86
90
|
"**/package-lock.json",
|
|
87
91
|
"**/yarn.lock",
|
|
88
92
|
"**/pnpm-lock.yaml",
|
|
93
|
+
"**/bun.lockb",
|
|
89
94
|
"**/output",
|
|
90
95
|
"**/coverage",
|
|
91
96
|
"**/temp",
|
|
@@ -94,6 +99,7 @@ var GLOB_EXCLUDE = [
|
|
|
94
99
|
"**/.vercel",
|
|
95
100
|
"**/.changeset",
|
|
96
101
|
"**/.idea",
|
|
102
|
+
"**/.cache",
|
|
97
103
|
"**/.output",
|
|
98
104
|
"**/.vite-inspect",
|
|
99
105
|
"**/CHANGELOG*.md",
|
|
@@ -107,7 +113,9 @@ var GLOB_EXCLUDE = [
|
|
|
107
113
|
// src/configs/ignores.ts
|
|
108
114
|
function ignores() {
|
|
109
115
|
return [
|
|
110
|
-
{
|
|
116
|
+
{
|
|
117
|
+
ignores: GLOB_EXCLUDE
|
|
118
|
+
}
|
|
111
119
|
];
|
|
112
120
|
}
|
|
113
121
|
|
|
@@ -118,14 +126,14 @@ function imports(options = {}) {
|
|
|
118
126
|
} = options;
|
|
119
127
|
return [
|
|
120
128
|
{
|
|
129
|
+
name: "coderwyd:imports",
|
|
121
130
|
plugins: {
|
|
122
131
|
antfu: default2,
|
|
123
|
-
import:
|
|
132
|
+
import: pluginImport
|
|
124
133
|
},
|
|
125
134
|
rules: {
|
|
126
135
|
"antfu/import-dedupe": "error",
|
|
127
136
|
"antfu/no-import-node-modules-by-path": "error",
|
|
128
|
-
"import/export": "error",
|
|
129
137
|
"import/first": "error",
|
|
130
138
|
"import/no-duplicates": "error",
|
|
131
139
|
"import/no-mutable-exports": "error",
|
|
@@ -154,12 +162,6 @@ function javascript(options = {}) {
|
|
|
154
162
|
overrides = {}
|
|
155
163
|
} = options;
|
|
156
164
|
return [
|
|
157
|
-
{
|
|
158
|
-
plugins: {
|
|
159
|
-
"antfu": default2,
|
|
160
|
-
"unused-imports": default12
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
165
|
{
|
|
164
166
|
languageOptions: {
|
|
165
167
|
ecmaVersion: 2022,
|
|
@@ -180,20 +182,21 @@ function javascript(options = {}) {
|
|
|
180
182
|
},
|
|
181
183
|
sourceType: "module"
|
|
182
184
|
},
|
|
185
|
+
name: "coderwyd:javascript",
|
|
186
|
+
plugins: {
|
|
187
|
+
"antfu": default2,
|
|
188
|
+
"unused-imports": default10
|
|
189
|
+
},
|
|
183
190
|
rules: {
|
|
184
191
|
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
185
|
-
"antfu/top-level-function": "error",
|
|
186
192
|
"array-callback-return": "error",
|
|
187
193
|
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
188
194
|
"block-scoped-var": "error",
|
|
189
195
|
"constructor-super": "error",
|
|
190
196
|
"default-case-last": "error",
|
|
191
197
|
"dot-notation": ["error", { allowKeywords: true }],
|
|
192
|
-
"eol-last": "error",
|
|
193
198
|
"eqeqeq": ["error", "smart"],
|
|
194
|
-
"max-statements-per-line": ["error", { max: 1 }],
|
|
195
199
|
"new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
|
|
196
|
-
"new-parens": "error",
|
|
197
200
|
"no-alert": "error",
|
|
198
201
|
"no-array-constructor": "error",
|
|
199
202
|
"no-async-promise-executor": "error",
|
|
@@ -204,7 +207,6 @@ function javascript(options = {}) {
|
|
|
204
207
|
"no-cond-assign": ["error", "always"],
|
|
205
208
|
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
206
209
|
"no-const-assign": "error",
|
|
207
|
-
"no-constant-condition": "warn",
|
|
208
210
|
"no-control-regex": "error",
|
|
209
211
|
"no-debugger": "error",
|
|
210
212
|
"no-delete-var": "error",
|
|
@@ -220,9 +222,7 @@ function javascript(options = {}) {
|
|
|
220
222
|
"no-extend-native": "error",
|
|
221
223
|
"no-extra-bind": "error",
|
|
222
224
|
"no-extra-boolean-cast": "error",
|
|
223
|
-
"no-extra-parens": ["error", "functions"],
|
|
224
225
|
"no-fallthrough": "error",
|
|
225
|
-
"no-floating-decimal": "error",
|
|
226
226
|
"no-func-assign": "error",
|
|
227
227
|
"no-global-assign": "error",
|
|
228
228
|
"no-implied-eval": "error",
|
|
@@ -235,14 +235,6 @@ function javascript(options = {}) {
|
|
|
235
235
|
"no-lone-blocks": "error",
|
|
236
236
|
"no-loss-of-precision": "error",
|
|
237
237
|
"no-misleading-character-class": "error",
|
|
238
|
-
"no-mixed-operators": ["error", {
|
|
239
|
-
allowSamePrecedence: true,
|
|
240
|
-
groups: [
|
|
241
|
-
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
|
242
|
-
["&&", "||"],
|
|
243
|
-
["in", "instanceof"]
|
|
244
|
-
]
|
|
245
|
-
}],
|
|
246
238
|
"no-multi-str": "error",
|
|
247
239
|
"no-new": "error",
|
|
248
240
|
"no-new-func": "error",
|
|
@@ -273,7 +265,9 @@ function javascript(options = {}) {
|
|
|
273
265
|
"error",
|
|
274
266
|
"DebuggerStatement",
|
|
275
267
|
"LabeledStatement",
|
|
276
|
-
"WithStatement"
|
|
268
|
+
"WithStatement",
|
|
269
|
+
"TSEnumDeclaration[const=true]",
|
|
270
|
+
"TSExportAssignment"
|
|
277
271
|
],
|
|
278
272
|
"no-self-assign": ["error", { props: true }],
|
|
279
273
|
"no-self-compare": "error",
|
|
@@ -343,7 +337,6 @@ function javascript(options = {}) {
|
|
|
343
337
|
"prefer-rest-params": "error",
|
|
344
338
|
"prefer-spread": "error",
|
|
345
339
|
"prefer-template": "error",
|
|
346
|
-
"quote-props": ["error", "consistent-as-needed"],
|
|
347
340
|
"sort-imports": [
|
|
348
341
|
"error",
|
|
349
342
|
{
|
|
@@ -364,13 +357,13 @@ function javascript(options = {}) {
|
|
|
364
357
|
"use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
|
|
365
358
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
366
359
|
"vars-on-top": "error",
|
|
367
|
-
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
368
360
|
"yoda": ["error", "never"],
|
|
369
361
|
...overrides
|
|
370
362
|
}
|
|
371
363
|
},
|
|
372
364
|
{
|
|
373
365
|
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
366
|
+
name: "coderwyd:scripts-overrides",
|
|
374
367
|
rules: {
|
|
375
368
|
"no-console": OFF
|
|
376
369
|
}
|
|
@@ -385,11 +378,10 @@ function jsdoc(options = {}) {
|
|
|
385
378
|
} = options;
|
|
386
379
|
return [
|
|
387
380
|
{
|
|
381
|
+
name: "coderwyd:jsdoc",
|
|
388
382
|
plugins: {
|
|
389
|
-
jsdoc:
|
|
390
|
-
}
|
|
391
|
-
},
|
|
392
|
-
{
|
|
383
|
+
jsdoc: default4
|
|
384
|
+
},
|
|
393
385
|
rules: {
|
|
394
386
|
"jsdoc/check-access": "warn",
|
|
395
387
|
"jsdoc/check-param-names": "warn",
|
|
@@ -406,7 +398,6 @@ function jsdoc(options = {}) {
|
|
|
406
398
|
"jsdoc/require-returns-check": "warn",
|
|
407
399
|
"jsdoc/require-returns-description": "warn",
|
|
408
400
|
"jsdoc/require-yields-check": "warn",
|
|
409
|
-
"jsdoc/valid-types": "warn",
|
|
410
401
|
...stylistic2 ? {
|
|
411
402
|
"jsdoc/check-alignment": "warn",
|
|
412
403
|
"jsdoc/multiline-blocks": "warn"
|
|
@@ -422,17 +413,22 @@ function jsonc(options = {}) {
|
|
|
422
413
|
stylistic: stylistic2 = true,
|
|
423
414
|
overrides = {}
|
|
424
415
|
} = options;
|
|
416
|
+
const {
|
|
417
|
+
indent = 2
|
|
418
|
+
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
425
419
|
return [
|
|
426
420
|
{
|
|
421
|
+
name: "coderwyd:jsonc:setup",
|
|
427
422
|
plugins: {
|
|
428
|
-
jsonc:
|
|
423
|
+
jsonc: pluginJsonc
|
|
429
424
|
}
|
|
430
425
|
},
|
|
431
426
|
{
|
|
432
427
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
433
428
|
languageOptions: {
|
|
434
|
-
parser:
|
|
429
|
+
parser: default19
|
|
435
430
|
},
|
|
431
|
+
name: "coderwyd:jsonc:rules",
|
|
436
432
|
rules: {
|
|
437
433
|
"jsonc/no-bigint-literals": "error",
|
|
438
434
|
"jsonc/no-binary-expression": "error",
|
|
@@ -464,7 +460,7 @@ function jsonc(options = {}) {
|
|
|
464
460
|
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
465
461
|
"jsonc/comma-dangle": ["error", "never"],
|
|
466
462
|
"jsonc/comma-style": ["error", "last"],
|
|
467
|
-
"jsonc/indent": ["error",
|
|
463
|
+
"jsonc/indent": ["error", indent],
|
|
468
464
|
"jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
469
465
|
"jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
470
466
|
"jsonc/object-curly-spacing": ["error", "always"],
|
|
@@ -486,12 +482,14 @@ function markdown(options = {}) {
|
|
|
486
482
|
} = options;
|
|
487
483
|
return [
|
|
488
484
|
{
|
|
485
|
+
name: "coderwyd:markdown:setup",
|
|
489
486
|
plugins: {
|
|
490
|
-
markdown:
|
|
487
|
+
markdown: default5
|
|
491
488
|
}
|
|
492
489
|
},
|
|
493
490
|
{
|
|
494
491
|
files: [GLOB_MARKDOWN],
|
|
492
|
+
name: "coderwyd:markdown:processor",
|
|
495
493
|
processor: "markdown/markdown"
|
|
496
494
|
},
|
|
497
495
|
{
|
|
@@ -506,10 +504,10 @@ function markdown(options = {}) {
|
|
|
506
504
|
}
|
|
507
505
|
}
|
|
508
506
|
},
|
|
507
|
+
name: "coderwyd:markdown:rules",
|
|
509
508
|
rules: {
|
|
510
509
|
"antfu/no-cjs-exports": OFF,
|
|
511
510
|
"antfu/no-ts-export-equal": OFF,
|
|
512
|
-
"eol-last": OFF,
|
|
513
511
|
"no-alert": OFF,
|
|
514
512
|
"no-console": OFF,
|
|
515
513
|
"no-undef": OFF,
|
|
@@ -517,6 +515,7 @@ function markdown(options = {}) {
|
|
|
517
515
|
"no-unused-vars": OFF,
|
|
518
516
|
"node/prefer-global/process": OFF,
|
|
519
517
|
"style/comma-dangle": OFF,
|
|
518
|
+
"style/eol-last": OFF,
|
|
520
519
|
"ts/consistent-type-imports": OFF,
|
|
521
520
|
"ts/no-namespace": OFF,
|
|
522
521
|
"ts/no-redeclare": OFF,
|
|
@@ -556,8 +555,9 @@ function markdown(options = {}) {
|
|
|
556
555
|
function node() {
|
|
557
556
|
return [
|
|
558
557
|
{
|
|
558
|
+
name: "coderwyd:node",
|
|
559
559
|
plugins: {
|
|
560
|
-
node:
|
|
560
|
+
node: default6
|
|
561
561
|
},
|
|
562
562
|
rules: {
|
|
563
563
|
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
@@ -578,6 +578,7 @@ function sortPackageJson() {
|
|
|
578
578
|
return [
|
|
579
579
|
{
|
|
580
580
|
files: ["**/package.json"],
|
|
581
|
+
name: "coderwyd:sort-package-json",
|
|
581
582
|
rules: {
|
|
582
583
|
"jsonc/sort-array-values": [
|
|
583
584
|
"error",
|
|
@@ -667,6 +668,7 @@ function sortTsconfig() {
|
|
|
667
668
|
return [
|
|
668
669
|
{
|
|
669
670
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
671
|
+
name: "coderwyd:sort-tsconfig",
|
|
670
672
|
rules: {
|
|
671
673
|
"jsonc/sort-keys": [
|
|
672
674
|
"error",
|
|
@@ -692,70 +694,39 @@ function sortTsconfig() {
|
|
|
692
694
|
"disableReferencedProjectLoad",
|
|
693
695
|
/* Language and Environment */
|
|
694
696
|
"target",
|
|
695
|
-
"lib",
|
|
696
697
|
"jsx",
|
|
697
|
-
"experimentalDecorators",
|
|
698
|
-
"emitDecoratorMetadata",
|
|
699
698
|
"jsxFactory",
|
|
700
699
|
"jsxFragmentFactory",
|
|
701
700
|
"jsxImportSource",
|
|
702
|
-
"
|
|
701
|
+
"lib",
|
|
702
|
+
"moduleDetection",
|
|
703
703
|
"noLib",
|
|
704
|
+
"reactNamespace",
|
|
704
705
|
"useDefineForClassFields",
|
|
705
|
-
"
|
|
706
|
+
"emitDecoratorMetadata",
|
|
707
|
+
"experimentalDecorators",
|
|
706
708
|
/* Modules */
|
|
707
|
-
"module",
|
|
708
|
-
"rootDir",
|
|
709
|
-
"moduleResolution",
|
|
710
709
|
"baseUrl",
|
|
711
|
-
"
|
|
710
|
+
"rootDir",
|
|
712
711
|
"rootDirs",
|
|
713
|
-
"
|
|
714
|
-
"
|
|
715
|
-
"
|
|
712
|
+
"customConditions",
|
|
713
|
+
"module",
|
|
714
|
+
"moduleResolution",
|
|
716
715
|
"moduleSuffixes",
|
|
717
|
-
"
|
|
716
|
+
"noResolve",
|
|
717
|
+
"paths",
|
|
718
|
+
"resolveJsonModule",
|
|
718
719
|
"resolvePackageJsonExports",
|
|
719
720
|
"resolvePackageJsonImports",
|
|
720
|
-
"
|
|
721
|
-
"
|
|
721
|
+
"typeRoots",
|
|
722
|
+
"types",
|
|
722
723
|
"allowArbitraryExtensions",
|
|
723
|
-
"
|
|
724
|
+
"allowImportingTsExtensions",
|
|
725
|
+
"allowUmdGlobalAccess",
|
|
724
726
|
/* JavaScript Support */
|
|
725
727
|
"allowJs",
|
|
726
728
|
"checkJs",
|
|
727
729
|
"maxNodeModuleJsDepth",
|
|
728
|
-
/* Emit */
|
|
729
|
-
"declaration",
|
|
730
|
-
"declarationMap",
|
|
731
|
-
"emitDeclarationOnly",
|
|
732
|
-
"sourceMap",
|
|
733
|
-
"inlineSourceMap",
|
|
734
|
-
"outFile",
|
|
735
|
-
"outDir",
|
|
736
|
-
"removeComments",
|
|
737
|
-
"noEmit",
|
|
738
|
-
"importHelpers",
|
|
739
|
-
"importsNotUsedAsValues",
|
|
740
|
-
"downlevelIteration",
|
|
741
|
-
"sourceRoot",
|
|
742
|
-
"mapRoot",
|
|
743
|
-
"inlineSources",
|
|
744
|
-
"emitBOM",
|
|
745
|
-
"newLine",
|
|
746
|
-
"stripInternal",
|
|
747
|
-
"noEmitHelpers",
|
|
748
|
-
"noEmitOnError",
|
|
749
|
-
"preserveConstEnums",
|
|
750
|
-
"declarationDir",
|
|
751
|
-
"preserveValueImports",
|
|
752
|
-
/* Interop Constraints */
|
|
753
|
-
"isolatedModules",
|
|
754
|
-
"verbatimModuleSyntax",
|
|
755
|
-
"allowSyntheticDefaultImports",
|
|
756
|
-
"esModuleInterop",
|
|
757
|
-
"preserveSymlinks",
|
|
758
|
-
"forceConsistentCasingInFileNames",
|
|
759
730
|
/* Type Checking */
|
|
760
731
|
"strict",
|
|
761
732
|
"strictBindCallApply",
|
|
@@ -776,6 +747,37 @@ function sortTsconfig() {
|
|
|
776
747
|
"noUnusedLocals",
|
|
777
748
|
"noUnusedParameters",
|
|
778
749
|
"useUnknownInCatchVariables",
|
|
750
|
+
/* Emit */
|
|
751
|
+
"declaration",
|
|
752
|
+
"declarationDir",
|
|
753
|
+
"declarationMap",
|
|
754
|
+
"downlevelIteration",
|
|
755
|
+
"emitBOM",
|
|
756
|
+
"emitDeclarationOnly",
|
|
757
|
+
"importHelpers",
|
|
758
|
+
"importsNotUsedAsValues",
|
|
759
|
+
"inlineSourceMap",
|
|
760
|
+
"inlineSources",
|
|
761
|
+
"mapRoot",
|
|
762
|
+
"newLine",
|
|
763
|
+
"noEmit",
|
|
764
|
+
"noEmitHelpers",
|
|
765
|
+
"noEmitOnError",
|
|
766
|
+
"outDir",
|
|
767
|
+
"outFile",
|
|
768
|
+
"preserveConstEnums",
|
|
769
|
+
"preserveValueImports",
|
|
770
|
+
"removeComments",
|
|
771
|
+
"sourceMap",
|
|
772
|
+
"sourceRoot",
|
|
773
|
+
"stripInternal",
|
|
774
|
+
/* Interop Constraints */
|
|
775
|
+
"allowSyntheticDefaultImports",
|
|
776
|
+
"esModuleInterop",
|
|
777
|
+
"forceConsistentCasingInFileNames",
|
|
778
|
+
"isolatedModules",
|
|
779
|
+
"preserveSymlinks",
|
|
780
|
+
"verbatimModuleSyntax",
|
|
779
781
|
/* Completeness */
|
|
780
782
|
"skipDefaultLibCheck",
|
|
781
783
|
"skipLibCheck"
|
|
@@ -789,16 +791,22 @@ function sortTsconfig() {
|
|
|
789
791
|
}
|
|
790
792
|
|
|
791
793
|
// src/configs/stylistic.ts
|
|
792
|
-
function stylistic() {
|
|
794
|
+
function stylistic(options = {}) {
|
|
795
|
+
const {
|
|
796
|
+
indent = 2,
|
|
797
|
+
quotes = "single"
|
|
798
|
+
} = options;
|
|
793
799
|
return [
|
|
794
800
|
{
|
|
801
|
+
name: "coderwyd:stylistic",
|
|
795
802
|
plugins: {
|
|
796
803
|
antfu: default2,
|
|
797
|
-
style:
|
|
804
|
+
style: default7
|
|
798
805
|
},
|
|
799
806
|
rules: {
|
|
800
807
|
"antfu/consistent-list-newline": "error",
|
|
801
808
|
"antfu/if-newline": "error",
|
|
809
|
+
"antfu/top-level-function": "error",
|
|
802
810
|
"curly": ["error", "multi-or-nest", "consistent"],
|
|
803
811
|
"style/array-bracket-spacing": ["error", "never"],
|
|
804
812
|
"style/arrow-spacing": ["error", { after: true, before: true }],
|
|
@@ -809,7 +817,8 @@ function stylistic() {
|
|
|
809
817
|
"style/comma-style": ["error", "last"],
|
|
810
818
|
"style/computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
|
|
811
819
|
"style/dot-location": ["error", "property"],
|
|
812
|
-
"style/
|
|
820
|
+
"style/eol-last": "error",
|
|
821
|
+
"style/indent": ["error", indent, {
|
|
813
822
|
ArrayExpression: 1,
|
|
814
823
|
CallExpression: { arguments: 1 },
|
|
815
824
|
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
@@ -847,22 +856,36 @@ function stylistic() {
|
|
|
847
856
|
offsetTernaryExpressions: true,
|
|
848
857
|
outerIIFEBody: 1
|
|
849
858
|
}],
|
|
859
|
+
"style/jsx-quotes": "error",
|
|
850
860
|
"style/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
851
861
|
"style/keyword-spacing": ["error", { after: true, before: true }],
|
|
852
862
|
"style/lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
|
|
863
|
+
"style/max-statements-per-line": ["error", { max: 1 }],
|
|
853
864
|
"style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
854
865
|
"style/multiline-ternary": ["error", "always-multiline"],
|
|
866
|
+
"style/new-parens": "error",
|
|
867
|
+
"style/no-extra-parens": ["error", "functions"],
|
|
868
|
+
"style/no-floating-decimal": "error",
|
|
869
|
+
"style/no-mixed-operators": ["error", {
|
|
870
|
+
allowSamePrecedence: true,
|
|
871
|
+
groups: [
|
|
872
|
+
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
|
873
|
+
["&&", "||"],
|
|
874
|
+
["in", "instanceof"]
|
|
875
|
+
]
|
|
876
|
+
}],
|
|
855
877
|
"style/no-mixed-spaces-and-tabs": "error",
|
|
856
878
|
"style/no-multi-spaces": "error",
|
|
857
879
|
"style/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
858
|
-
"style/no-tabs": "error",
|
|
880
|
+
"style/no-tabs": indent === "tab" ? "off" : "error",
|
|
859
881
|
"style/no-trailing-spaces": "error",
|
|
860
882
|
"style/no-whitespace-before-property": "error",
|
|
861
883
|
"style/object-curly-spacing": ["error", "always"],
|
|
862
884
|
"style/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
863
885
|
"style/operator-linebreak": ["error", "before"],
|
|
864
886
|
"style/padded-blocks": ["error", { blocks: "never", classes: "never", switches: "never" }],
|
|
865
|
-
"style/
|
|
887
|
+
"style/quote-props": ["error", "consistent-as-needed"],
|
|
888
|
+
"style/quotes": ["error", quotes, { allowTemplateLiterals: true, avoidEscape: false }],
|
|
866
889
|
"style/rest-spread-spacing": ["error", "never"],
|
|
867
890
|
"style/semi": ["error", "never"],
|
|
868
891
|
"style/semi-spacing": ["error", { after: true, before: false }],
|
|
@@ -885,6 +908,7 @@ function stylistic() {
|
|
|
885
908
|
"style/template-curly-spacing": "error",
|
|
886
909
|
"style/template-tag-spacing": ["error", "never"],
|
|
887
910
|
"style/type-annotation-spacing": ["error", {}],
|
|
911
|
+
"style/wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
888
912
|
"style/yield-star-spacing": ["error", "both"]
|
|
889
913
|
}
|
|
890
914
|
}
|
|
@@ -921,6 +945,7 @@ function typescript(options) {
|
|
|
921
945
|
"no-implied-eval": OFF,
|
|
922
946
|
"no-throw-literal": OFF,
|
|
923
947
|
"ts/await-thenable": "error",
|
|
948
|
+
"ts/ban-types": ["error", { types: { Function: false } }],
|
|
924
949
|
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
925
950
|
"ts/no-floating-promises": "error",
|
|
926
951
|
"ts/no-for-in-array": "error",
|
|
@@ -939,20 +964,20 @@ function typescript(options) {
|
|
|
939
964
|
};
|
|
940
965
|
return [
|
|
941
966
|
{
|
|
967
|
+
name: "coderwyd:typescript:setup",
|
|
942
968
|
plugins: {
|
|
943
969
|
antfu: default2,
|
|
944
|
-
import:
|
|
945
|
-
ts:
|
|
970
|
+
import: pluginImport,
|
|
971
|
+
ts: default8
|
|
946
972
|
}
|
|
947
973
|
},
|
|
948
974
|
{
|
|
949
975
|
files: [
|
|
950
|
-
|
|
951
|
-
GLOB_TSX,
|
|
976
|
+
GLOB_SRC,
|
|
952
977
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
953
978
|
],
|
|
954
979
|
languageOptions: {
|
|
955
|
-
parser:
|
|
980
|
+
parser: parserTs,
|
|
956
981
|
parserOptions: {
|
|
957
982
|
sourceType: "module",
|
|
958
983
|
...tsconfigPath ? {
|
|
@@ -962,24 +987,22 @@ function typescript(options) {
|
|
|
962
987
|
...parserOptions
|
|
963
988
|
}
|
|
964
989
|
},
|
|
990
|
+
name: "coderwyd:typescript:rules",
|
|
965
991
|
rules: {
|
|
966
992
|
...renameRules(
|
|
967
|
-
|
|
993
|
+
default8.configs["eslint-recommended"].overrides[0].rules,
|
|
968
994
|
"@typescript-eslint/",
|
|
969
995
|
"ts/"
|
|
970
996
|
),
|
|
971
997
|
...renameRules(
|
|
972
|
-
|
|
998
|
+
default8.configs.strict.rules,
|
|
973
999
|
"@typescript-eslint/",
|
|
974
1000
|
"ts/"
|
|
975
1001
|
),
|
|
976
1002
|
"antfu/generic-spacing": "error",
|
|
977
1003
|
"antfu/named-tuple-spacing": "error",
|
|
978
1004
|
"antfu/no-cjs-exports": "error",
|
|
979
|
-
"antfu/no-const-enum": "error",
|
|
980
|
-
"antfu/no-ts-export-equal": "error",
|
|
981
1005
|
"no-dupe-class-members": OFF,
|
|
982
|
-
"no-extra-parens": OFF,
|
|
983
1006
|
"no-invalid-this": OFF,
|
|
984
1007
|
"no-loss-of-precision": OFF,
|
|
985
1008
|
"no-redeclare": OFF,
|
|
@@ -992,7 +1015,7 @@ function typescript(options) {
|
|
|
992
1015
|
"ts/no-dupe-class-members": "error",
|
|
993
1016
|
"ts/no-dynamic-delete": OFF,
|
|
994
1017
|
"ts/no-explicit-any": OFF,
|
|
995
|
-
"ts/no-
|
|
1018
|
+
"ts/no-extraneous-class": OFF,
|
|
996
1019
|
"ts/no-invalid-this": "error",
|
|
997
1020
|
"ts/no-invalid-void-type": OFF,
|
|
998
1021
|
"ts/no-loss-of-precision": "error",
|
|
@@ -1001,28 +1024,34 @@ function typescript(options) {
|
|
|
1001
1024
|
"ts/no-require-imports": "error",
|
|
1002
1025
|
"ts/no-unused-vars": OFF,
|
|
1003
1026
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
1027
|
+
"ts/no-useless-constructor": OFF,
|
|
1004
1028
|
"ts/prefer-ts-expect-error": "error",
|
|
1005
1029
|
"ts/triple-slash-reference": OFF,
|
|
1030
|
+
"ts/unified-signatures": OFF,
|
|
1006
1031
|
...tsconfigPath ? typeAwareRules : {},
|
|
1007
1032
|
...overrides
|
|
1008
1033
|
}
|
|
1009
1034
|
},
|
|
1010
1035
|
{
|
|
1011
1036
|
files: ["**/*.d.ts"],
|
|
1037
|
+
name: "coderwyd:typescript:dts-overrides",
|
|
1012
1038
|
rules: {
|
|
1013
1039
|
"eslint-comments/no-unlimited-disable": OFF,
|
|
1014
1040
|
"import/no-duplicates": OFF,
|
|
1041
|
+
"no-restricted-syntax": OFF,
|
|
1015
1042
|
"unused-imports/no-unused-vars": OFF
|
|
1016
1043
|
}
|
|
1017
1044
|
},
|
|
1018
1045
|
{
|
|
1019
1046
|
files: GLOB_TESTS,
|
|
1047
|
+
name: "coderwyd:typescript:tests-overrides",
|
|
1020
1048
|
rules: {
|
|
1021
1049
|
"no-unused-expressions": OFF
|
|
1022
1050
|
}
|
|
1023
1051
|
},
|
|
1024
1052
|
{
|
|
1025
|
-
files: [
|
|
1053
|
+
files: [GLOB_JS],
|
|
1054
|
+
name: "coderwyd:typescript:javascript-overrides",
|
|
1026
1055
|
rules: {
|
|
1027
1056
|
"ts/no-require-imports": OFF,
|
|
1028
1057
|
"ts/no-var-requires": OFF
|
|
@@ -1035,11 +1064,10 @@ function typescript(options) {
|
|
|
1035
1064
|
function unicorn() {
|
|
1036
1065
|
return [
|
|
1037
1066
|
{
|
|
1067
|
+
name: "coderwyd:unicorn",
|
|
1038
1068
|
plugins: {
|
|
1039
|
-
unicorn:
|
|
1040
|
-
}
|
|
1041
|
-
},
|
|
1042
|
-
{
|
|
1069
|
+
unicorn: default9
|
|
1070
|
+
},
|
|
1043
1071
|
rules: {
|
|
1044
1072
|
// Pass error message when throwing errors
|
|
1045
1073
|
"unicorn/error-message": "error",
|
|
@@ -1051,10 +1079,10 @@ function unicorn() {
|
|
|
1051
1079
|
"unicorn/no-new-array": "error",
|
|
1052
1080
|
// Prevent deprecated `new Buffer()`
|
|
1053
1081
|
"unicorn/no-new-buffer": "error",
|
|
1054
|
-
// Keep regex literals safe!
|
|
1055
|
-
"unicorn/no-unsafe-regex": "error",
|
|
1056
1082
|
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
1057
1083
|
"unicorn/number-literal-case": "error",
|
|
1084
|
+
// textContent instead of innerText
|
|
1085
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
1058
1086
|
// includes over indexOf when checking for existence
|
|
1059
1087
|
"unicorn/prefer-includes": "error",
|
|
1060
1088
|
// Prefer using the node: protocol
|
|
@@ -1063,8 +1091,6 @@ function unicorn() {
|
|
|
1063
1091
|
"unicorn/prefer-number-properties": "error",
|
|
1064
1092
|
// String methods startsWith/endsWith instead of more complicated stuff
|
|
1065
1093
|
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1066
|
-
// textContent instead of innerText
|
|
1067
|
-
"unicorn/prefer-text-content": "error",
|
|
1068
1094
|
// Enforce throwing type error when throwing error while checking typeof
|
|
1069
1095
|
"unicorn/prefer-type-error": "error",
|
|
1070
1096
|
// Use new when throwing error
|
|
@@ -1101,8 +1127,12 @@ function vue(options = {}) {
|
|
|
1101
1127
|
overrides = {},
|
|
1102
1128
|
stylistic: stylistic2 = true
|
|
1103
1129
|
} = options;
|
|
1130
|
+
const {
|
|
1131
|
+
indent = 2
|
|
1132
|
+
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1104
1133
|
return [
|
|
1105
1134
|
{
|
|
1135
|
+
name: "coderwyd:vue:setup",
|
|
1106
1136
|
plugins: {
|
|
1107
1137
|
vue: default13
|
|
1108
1138
|
}
|
|
@@ -1110,16 +1140,17 @@ function vue(options = {}) {
|
|
|
1110
1140
|
{
|
|
1111
1141
|
files: [GLOB_VUE],
|
|
1112
1142
|
languageOptions: {
|
|
1113
|
-
parser:
|
|
1143
|
+
parser: default17,
|
|
1114
1144
|
parserOptions: {
|
|
1115
1145
|
ecmaFeatures: {
|
|
1116
1146
|
jsx: true
|
|
1117
1147
|
},
|
|
1118
1148
|
extraFileExtensions: [".vue"],
|
|
1119
|
-
parser: options.typescript ?
|
|
1149
|
+
parser: options.typescript ? parserTs : null,
|
|
1120
1150
|
sourceType: "module"
|
|
1121
1151
|
}
|
|
1122
1152
|
},
|
|
1153
|
+
name: "coderwyd:vue:rules",
|
|
1123
1154
|
processor: default13.processors[".vue"],
|
|
1124
1155
|
rules: {
|
|
1125
1156
|
...isVue3 ? vue3Rules : vue2Rules,
|
|
@@ -1136,6 +1167,8 @@ function vue(options = {}) {
|
|
|
1136
1167
|
"vue/dot-location": ["error", "property"],
|
|
1137
1168
|
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1138
1169
|
"vue/eqeqeq": ["error", "smart"],
|
|
1170
|
+
"vue/html-indent": ["error", indent],
|
|
1171
|
+
"vue/html-quotes": ["error", "double"],
|
|
1139
1172
|
"vue/max-attributes-per-line": OFF,
|
|
1140
1173
|
"vue/multi-word-component-names": OFF,
|
|
1141
1174
|
"vue/no-dupe-keys": OFF,
|
|
@@ -1207,17 +1240,23 @@ function yaml(options = {}) {
|
|
|
1207
1240
|
overrides = {},
|
|
1208
1241
|
stylistic: stylistic2 = true
|
|
1209
1242
|
} = options;
|
|
1243
|
+
const {
|
|
1244
|
+
indent = 2,
|
|
1245
|
+
quotes = "single"
|
|
1246
|
+
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1210
1247
|
return [
|
|
1211
1248
|
{
|
|
1249
|
+
name: "coderwyd:yaml:setup",
|
|
1212
1250
|
plugins: {
|
|
1213
|
-
yaml:
|
|
1251
|
+
yaml: pluginYaml
|
|
1214
1252
|
}
|
|
1215
1253
|
},
|
|
1216
1254
|
{
|
|
1217
1255
|
files: [GLOB_YAML],
|
|
1218
1256
|
languageOptions: {
|
|
1219
|
-
parser:
|
|
1257
|
+
parser: default18
|
|
1220
1258
|
},
|
|
1259
|
+
name: "coderwyd:yaml:rules",
|
|
1221
1260
|
rules: {
|
|
1222
1261
|
"style/spaced-comment": OFF,
|
|
1223
1262
|
"yaml/block-mapping": "error",
|
|
@@ -1234,10 +1273,10 @@ function yaml(options = {}) {
|
|
|
1234
1273
|
"yaml/flow-mapping-curly-spacing": "error",
|
|
1235
1274
|
"yaml/flow-sequence-bracket-newline": "error",
|
|
1236
1275
|
"yaml/flow-sequence-bracket-spacing": "error",
|
|
1237
|
-
"yaml/indent": ["error", 2],
|
|
1276
|
+
"yaml/indent": ["error", indent === "tab" ? 2 : indent],
|
|
1238
1277
|
"yaml/key-spacing": "error",
|
|
1239
1278
|
"yaml/no-tab-indent": "error",
|
|
1240
|
-
"yaml/quotes": ["error", { avoidEscape: false, prefer:
|
|
1279
|
+
"yaml/quotes": ["error", { avoidEscape: false, prefer: quotes }],
|
|
1241
1280
|
"yaml/spaced-comment": "error"
|
|
1242
1281
|
} : {},
|
|
1243
1282
|
...overrides
|
|
@@ -1252,53 +1291,214 @@ function test(options = {}) {
|
|
|
1252
1291
|
isInEditor = false,
|
|
1253
1292
|
overrides = {}
|
|
1254
1293
|
} = options;
|
|
1255
|
-
return [
|
|
1256
|
-
|
|
1257
|
-
"
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1294
|
+
return [
|
|
1295
|
+
{
|
|
1296
|
+
name: "coderwyd:test:setup",
|
|
1297
|
+
plugins: {
|
|
1298
|
+
test: {
|
|
1299
|
+
...default12,
|
|
1300
|
+
rules: {
|
|
1301
|
+
...default12.rules,
|
|
1302
|
+
// extend `test/no-only-tests` rule
|
|
1303
|
+
...default11.rules
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
},
|
|
1308
|
+
{
|
|
1309
|
+
files: GLOB_TESTS,
|
|
1310
|
+
name: "coderwyd:test:rules",
|
|
1311
|
+
rules: {
|
|
1312
|
+
"test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
|
|
1313
|
+
"test/no-identical-title": "error",
|
|
1314
|
+
"test/no-only-tests": isInEditor ? OFF : "error",
|
|
1315
|
+
"test/prefer-hooks-in-order": "error",
|
|
1316
|
+
"test/prefer-lowercase-title": "error",
|
|
1317
|
+
...overrides
|
|
1318
|
+
}
|
|
1264
1319
|
}
|
|
1265
|
-
|
|
1320
|
+
];
|
|
1266
1321
|
}
|
|
1267
1322
|
|
|
1268
1323
|
// src/configs/react.ts
|
|
1324
|
+
import globals2 from "globals";
|
|
1269
1325
|
function react(options = {}) {
|
|
1270
1326
|
const {
|
|
1271
|
-
overrides = {}
|
|
1327
|
+
overrides = {},
|
|
1328
|
+
stylistic: stylistic2 = true
|
|
1272
1329
|
} = options;
|
|
1330
|
+
const {
|
|
1331
|
+
indent = 2
|
|
1332
|
+
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1333
|
+
const extensions = [GLOB_JSX, ...[options.typescript ? GLOB_TSX : ""]];
|
|
1273
1334
|
return [
|
|
1274
1335
|
{
|
|
1336
|
+
name: "coderwyd:react:setup",
|
|
1275
1337
|
plugins: {
|
|
1276
|
-
"react":
|
|
1277
|
-
"react-hooks":
|
|
1338
|
+
"react": default14,
|
|
1339
|
+
"react-hooks": default15
|
|
1340
|
+
},
|
|
1341
|
+
settings: {
|
|
1342
|
+
"import/extensions": extensions,
|
|
1343
|
+
"import/resolver": {
|
|
1344
|
+
node: { extensions }
|
|
1345
|
+
},
|
|
1346
|
+
"react": {
|
|
1347
|
+
version: "detect"
|
|
1348
|
+
}
|
|
1278
1349
|
}
|
|
1279
1350
|
},
|
|
1280
1351
|
{
|
|
1281
|
-
files: [GLOB_JSX, GLOB_TSX],
|
|
1352
|
+
files: [GLOB_JSX, ...[options.typescript ? GLOB_TSX : ""]],
|
|
1282
1353
|
languageOptions: {
|
|
1354
|
+
globals: globals2.browser,
|
|
1283
1355
|
parserOptions: {
|
|
1284
1356
|
ecmaFeatures: {
|
|
1285
1357
|
jsx: true
|
|
1286
1358
|
},
|
|
1287
|
-
|
|
1288
|
-
|
|
1359
|
+
// for @typescript/eslint-parser
|
|
1360
|
+
jsxPragma: void 0,
|
|
1361
|
+
// FIXME: @typescript-eslint v6 throws deprecation warnings
|
|
1362
|
+
// See https://github.com/jsx-eslint/eslint-plugin-react/issues/3602
|
|
1363
|
+
// Remove this when they support typescript 5.2
|
|
1364
|
+
suppressDeprecatedPropertyWarnings: true
|
|
1289
1365
|
}
|
|
1290
1366
|
},
|
|
1367
|
+
name: "coderwyd:react:rules",
|
|
1291
1368
|
rules: {
|
|
1292
|
-
|
|
1293
|
-
...
|
|
1294
|
-
"
|
|
1295
|
-
|
|
1369
|
+
...default14.configs.recommended.rules,
|
|
1370
|
+
...default15.configs.recommended.rules,
|
|
1371
|
+
"node/prefer-global/process": OFF,
|
|
1372
|
+
"react/display-name": ["off", { ignoreTranspilerName: false }],
|
|
1373
|
+
"react/iframe-missing-sandbox": "warn",
|
|
1374
|
+
"react/jsx-curly-brace-presence": ["error", { children: "never", props: "never" }],
|
|
1375
|
+
"react/no-unknown-property": ["error", {
|
|
1376
|
+
ignore: [
|
|
1377
|
+
// SVG
|
|
1378
|
+
"clip-path",
|
|
1379
|
+
"clip-rule",
|
|
1380
|
+
"fill-opacity",
|
|
1381
|
+
"fill-rule",
|
|
1382
|
+
"stroke-dasharray",
|
|
1383
|
+
"stroke-dashoffset",
|
|
1384
|
+
"stroke-linecap",
|
|
1385
|
+
"stroke-linejoin",
|
|
1386
|
+
"stroke-miterlimit",
|
|
1387
|
+
"stroke-opacity",
|
|
1388
|
+
"stroke-width"
|
|
1389
|
+
]
|
|
1390
|
+
}],
|
|
1391
|
+
"react/no-unused-class-component-methods": "error",
|
|
1392
|
+
"react/no-unused-state": "error",
|
|
1393
|
+
"react/prop-types": "off",
|
|
1394
|
+
"react/react-in-jsx-scope": "off",
|
|
1395
|
+
...stylistic2 ? {
|
|
1396
|
+
"react/jsx-boolean-value": ["error", "never", { always: [] }],
|
|
1397
|
+
"react/jsx-closing-bracket-location": ["error", "tag-aligned"],
|
|
1398
|
+
"react/jsx-curly-newline": ["error", {
|
|
1399
|
+
multiline: "consistent",
|
|
1400
|
+
singleline: "consistent"
|
|
1401
|
+
}],
|
|
1402
|
+
"react/jsx-curly-spacing": ["error", "never", { allowMultiline: true }],
|
|
1403
|
+
"react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
|
|
1404
|
+
"react/jsx-fragments": ["error", "syntax"],
|
|
1405
|
+
"react/jsx-indent": ["error", indent, { checkAttributes: false, indentLogicalExpressions: true }],
|
|
1406
|
+
"react/jsx-indent-props": ["error", indent],
|
|
1407
|
+
"react/jsx-max-props-per-line": ["error", { maximum: 1, when: "multiline" }],
|
|
1408
|
+
"react/jsx-no-useless-fragment": "error",
|
|
1409
|
+
"react/jsx-props-no-multi-spaces": "error",
|
|
1410
|
+
"react/jsx-tag-spacing": ["error", {
|
|
1411
|
+
afterOpening: "never",
|
|
1412
|
+
beforeClosing: "never",
|
|
1413
|
+
beforeSelfClosing: "always",
|
|
1414
|
+
closingSlash: "never"
|
|
1415
|
+
}],
|
|
1416
|
+
"react/jsx-wrap-multilines": ["error", {
|
|
1417
|
+
arrow: "parens-new-line",
|
|
1418
|
+
assignment: "parens-new-line",
|
|
1419
|
+
condition: "parens-new-line",
|
|
1420
|
+
declaration: "parens-new-line",
|
|
1421
|
+
logical: "parens-new-line",
|
|
1422
|
+
prop: "parens-new-line",
|
|
1423
|
+
return: "parens-new-line"
|
|
1424
|
+
}],
|
|
1425
|
+
"react/sort-comp": ["error", {
|
|
1426
|
+
groups: {
|
|
1427
|
+
lifecycle: [
|
|
1428
|
+
"displayName",
|
|
1429
|
+
"propTypes",
|
|
1430
|
+
"contextTypes",
|
|
1431
|
+
"childContextTypes",
|
|
1432
|
+
"mixins",
|
|
1433
|
+
"statics",
|
|
1434
|
+
"defaultProps",
|
|
1435
|
+
"constructor",
|
|
1436
|
+
"getDefaultProps",
|
|
1437
|
+
"getInitialState",
|
|
1438
|
+
"state",
|
|
1439
|
+
"getChildContext",
|
|
1440
|
+
"getDerivedStateFromProps",
|
|
1441
|
+
"componentWillMount",
|
|
1442
|
+
"UNSAFE_componentWillMount",
|
|
1443
|
+
"componentDidMount",
|
|
1444
|
+
"componentWillReceiveProps",
|
|
1445
|
+
"UNSAFE_componentWillReceiveProps",
|
|
1446
|
+
"shouldComponentUpdate",
|
|
1447
|
+
"componentWillUpdate",
|
|
1448
|
+
"UNSAFE_componentWillUpdate",
|
|
1449
|
+
"getSnapshotBeforeUpdate",
|
|
1450
|
+
"componentDidUpdate",
|
|
1451
|
+
"componentDidCatch",
|
|
1452
|
+
"componentWillUnmount"
|
|
1453
|
+
],
|
|
1454
|
+
rendering: [
|
|
1455
|
+
"/^render.+$/",
|
|
1456
|
+
"render"
|
|
1457
|
+
]
|
|
1458
|
+
},
|
|
1459
|
+
order: [
|
|
1460
|
+
"static-variables",
|
|
1461
|
+
"static-methods",
|
|
1462
|
+
"instance-variables",
|
|
1463
|
+
"lifecycle",
|
|
1464
|
+
"/^handle.+$/",
|
|
1465
|
+
"/^on.+$/",
|
|
1466
|
+
"getters",
|
|
1467
|
+
"setters",
|
|
1468
|
+
"/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/",
|
|
1469
|
+
"instance-methods",
|
|
1470
|
+
"everything-else",
|
|
1471
|
+
"rendering"
|
|
1472
|
+
]
|
|
1473
|
+
}],
|
|
1474
|
+
"react/style-prop-object": "error",
|
|
1475
|
+
"style/indent": ["error", indent, {
|
|
1476
|
+
SwitchCase: 1,
|
|
1477
|
+
VariableDeclarator: 1,
|
|
1478
|
+
// from: https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
|
|
1479
|
+
ignoredNodes: [
|
|
1480
|
+
"JSXElement",
|
|
1481
|
+
"JSXElement :not(JSXExpressionContainer, JSXExpressionContainer *)",
|
|
1482
|
+
"JSXAttribute",
|
|
1483
|
+
"JSXIdentifier",
|
|
1484
|
+
"JSXNamespacedName",
|
|
1485
|
+
"JSXMemberExpression",
|
|
1486
|
+
"JSXSpreadAttribute",
|
|
1487
|
+
"JSXOpeningElement",
|
|
1488
|
+
"JSXClosingElement",
|
|
1489
|
+
"JSXFragment",
|
|
1490
|
+
"JSXOpeningFragment",
|
|
1491
|
+
"JSXClosingFragment",
|
|
1492
|
+
"JSXText",
|
|
1493
|
+
"JSXEmptyExpression",
|
|
1494
|
+
"JSXSpreadChild"
|
|
1495
|
+
],
|
|
1496
|
+
offsetTernaryExpressions: true,
|
|
1497
|
+
outerIIFEBody: 1
|
|
1498
|
+
}],
|
|
1499
|
+
"style/jsx-quotes": ["error", "prefer-double"]
|
|
1500
|
+
} : {},
|
|
1296
1501
|
...overrides
|
|
1297
|
-
},
|
|
1298
|
-
settings: {
|
|
1299
|
-
react: {
|
|
1300
|
-
version: "detect"
|
|
1301
|
-
}
|
|
1302
1502
|
}
|
|
1303
1503
|
}
|
|
1304
1504
|
];
|
|
@@ -1308,22 +1508,21 @@ function react(options = {}) {
|
|
|
1308
1508
|
function astro(options = {}) {
|
|
1309
1509
|
const { overrides = {} } = options;
|
|
1310
1510
|
return [
|
|
1311
|
-
{
|
|
1312
|
-
plugins: {
|
|
1313
|
-
astro: default18
|
|
1314
|
-
}
|
|
1315
|
-
},
|
|
1316
1511
|
{
|
|
1317
1512
|
files: [GLOB_ASTRO],
|
|
1318
1513
|
languageOptions: {
|
|
1319
|
-
parser:
|
|
1514
|
+
parser: default20,
|
|
1320
1515
|
parserOptions: {
|
|
1321
1516
|
extraFileExtensions: [".astro"],
|
|
1322
|
-
parser: options.typescript ?
|
|
1517
|
+
parser: options.typescript ? parserTs : null
|
|
1323
1518
|
}
|
|
1324
1519
|
},
|
|
1520
|
+
name: "coderwyd:astro",
|
|
1521
|
+
plugins: {
|
|
1522
|
+
astro: default16
|
|
1523
|
+
},
|
|
1325
1524
|
rules: {
|
|
1326
|
-
...
|
|
1525
|
+
...default16.configs.recommended.rules,
|
|
1327
1526
|
...overrides
|
|
1328
1527
|
}
|
|
1329
1528
|
}
|
|
@@ -1397,8 +1596,11 @@ function coderwyd(options = {}, ...userConfigs) {
|
|
|
1397
1596
|
overrides: overrides.typescript
|
|
1398
1597
|
}));
|
|
1399
1598
|
}
|
|
1400
|
-
if (enableStylistic)
|
|
1401
|
-
configs.push(stylistic(
|
|
1599
|
+
if (enableStylistic) {
|
|
1600
|
+
configs.push(stylistic(
|
|
1601
|
+
typeof enableStylistic === "boolean" ? {} : enableStylistic
|
|
1602
|
+
));
|
|
1603
|
+
}
|
|
1402
1604
|
if (options.test ?? true)
|
|
1403
1605
|
configs.push(test({ isInEditor, overrides: overrides.test }));
|
|
1404
1606
|
if (enableVue) {
|
|
@@ -1487,28 +1689,29 @@ export {
|
|
|
1487
1689
|
jsonc,
|
|
1488
1690
|
markdown,
|
|
1489
1691
|
node,
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1692
|
+
default20 as parserAstro,
|
|
1693
|
+
default19 as parserJsonc,
|
|
1694
|
+
parserTs,
|
|
1695
|
+
default17 as parserVue,
|
|
1696
|
+
default18 as parserYaml,
|
|
1495
1697
|
default2 as pluginAntfu,
|
|
1496
|
-
|
|
1698
|
+
default16 as pluginAstro,
|
|
1497
1699
|
default3 as pluginComments,
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1700
|
+
pluginImport,
|
|
1701
|
+
default4 as pluginJsdoc,
|
|
1702
|
+
pluginJsonc,
|
|
1703
|
+
default5 as pluginMarkdown,
|
|
1704
|
+
default11 as pluginNoOnlyTests,
|
|
1705
|
+
default6 as pluginNode,
|
|
1706
|
+
default14 as pluginReact,
|
|
1707
|
+
default15 as pluginReactHooks,
|
|
1708
|
+
default7 as pluginStylistic,
|
|
1709
|
+
default8 as pluginTs,
|
|
1710
|
+
default9 as pluginUnicorn,
|
|
1711
|
+
default10 as pluginUnusedImports,
|
|
1712
|
+
default12 as pluginVitest,
|
|
1510
1713
|
default13 as pluginVue,
|
|
1511
|
-
|
|
1714
|
+
pluginYaml,
|
|
1512
1715
|
react,
|
|
1513
1716
|
renameRules,
|
|
1514
1717
|
sortPackageJson,
|