@dhzh/eslint-config 0.4.3 → 0.5.0
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 +1 -0
- package/dist/cli.cjs +20 -8
- package/dist/cli.js +20 -8
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -0
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ Differences from [@antfu/eslint-config](./README-antfu.md):
|
|
|
11
11
|
3. Explicitly use `1tbs` as brace style: `braceStyle: '1tbs'`.
|
|
12
12
|
4. Disabled antfu's top level function rule: `'antfu/top-level-function': 'off'`.
|
|
13
13
|
5. Always curly: `'curly': ['error', 'all']`.
|
|
14
|
+
6. This eslint-config will enable `ts/consistent-type-imports` rule. But it will cause [compile issue](https://github.com/typescript-eslint/typescript-eslint/issues/2559) in [nest](https://nestjs.com/) projects. So I [disabled it](https://github.com/typescript-eslint/typescript-eslint/issues/2559#issuecomment-692780580) in this config in nest framework.
|
|
14
15
|
|
|
15
16
|
## Usage
|
|
16
17
|
|
package/dist/cli.cjs
CHANGED
|
@@ -48,7 +48,7 @@ var import_picocolors = __toESM(require("picocolors"), 1);
|
|
|
48
48
|
var package_default = {
|
|
49
49
|
name: "@dhzh/eslint-config",
|
|
50
50
|
type: "module",
|
|
51
|
-
version: "0.
|
|
51
|
+
version: "0.5.0",
|
|
52
52
|
packageManager: "pnpm@9.1.0",
|
|
53
53
|
description: "Easton's ESLint config",
|
|
54
54
|
author: "Easton Zheng <dhzhme@gmail.com>",
|
|
@@ -130,7 +130,7 @@ var package_default = {
|
|
|
130
130
|
"@antfu/install-pkg": "^0.3.3",
|
|
131
131
|
"@clack/prompts": "^0.7.0",
|
|
132
132
|
"@eslint-react/eslint-plugin": "^1.5.11",
|
|
133
|
-
"@stylistic/eslint-plugin": "^2.
|
|
133
|
+
"@stylistic/eslint-plugin": "^2.1.0",
|
|
134
134
|
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
|
135
135
|
"@typescript-eslint/parser": "^7.8.0",
|
|
136
136
|
"eslint-config-flat-gitignore": "^0.1.5",
|
|
@@ -152,7 +152,7 @@ var package_default = {
|
|
|
152
152
|
"eslint-plugin-unicorn": "^52.0.0",
|
|
153
153
|
"eslint-plugin-unused-imports": "^3.2.0",
|
|
154
154
|
"eslint-plugin-vitest": "^0.5.4",
|
|
155
|
-
"eslint-plugin-vue": "^9.
|
|
155
|
+
"eslint-plugin-vue": "^9.26.0",
|
|
156
156
|
"eslint-plugin-yml": "^1.14.0",
|
|
157
157
|
"eslint-processor-vue-blocks": "^0.1.2",
|
|
158
158
|
globals: "^15.1.0",
|
|
@@ -169,13 +169,13 @@ var package_default = {
|
|
|
169
169
|
"@antfu/ni": "^0.21.12",
|
|
170
170
|
"@dhzh/eslint-config": "workspace:*",
|
|
171
171
|
"@eslint/config-inspector": "^0.4.8",
|
|
172
|
-
"@stylistic/eslint-plugin-migrate": "^2.
|
|
172
|
+
"@stylistic/eslint-plugin-migrate": "^2.1.0",
|
|
173
173
|
"@types/eslint": "^8.56.10",
|
|
174
174
|
"@types/fs-extra": "^11.0.4",
|
|
175
175
|
"@types/node": "^20.12.11",
|
|
176
176
|
"@types/prompts": "^2.4.9",
|
|
177
177
|
"@types/yargs": "^17.0.32",
|
|
178
|
-
"@unocss/eslint-plugin": "^0.
|
|
178
|
+
"@unocss/eslint-plugin": "^0.60.0",
|
|
179
179
|
"astro-eslint-parser": "^1.0.2",
|
|
180
180
|
bumpp: "^9.4.1",
|
|
181
181
|
"bundle-require": "^4.1.0",
|
|
@@ -186,7 +186,7 @@ var package_default = {
|
|
|
186
186
|
"eslint-plugin-svelte": "^2.38.0",
|
|
187
187
|
"eslint-typegen": "^0.2.4",
|
|
188
188
|
esno: "^4.7.0",
|
|
189
|
-
execa: "^
|
|
189
|
+
execa: "^9.0.0",
|
|
190
190
|
"fast-glob": "^3.3.2",
|
|
191
191
|
"fs-extra": "^11.2.0",
|
|
192
192
|
"lint-staged": "^15.2.2",
|
|
@@ -195,7 +195,7 @@ var package_default = {
|
|
|
195
195
|
rimraf: "^5.0.5",
|
|
196
196
|
"simple-git-hooks": "^2.11.1",
|
|
197
197
|
svelte: "^4.2.16",
|
|
198
|
-
"svelte-eslint-parser": "^0.
|
|
198
|
+
"svelte-eslint-parser": "^0.36.0",
|
|
199
199
|
tsup: "^8.0.2",
|
|
200
200
|
typescript: "^5.4.5",
|
|
201
201
|
vitest: "^1.6.0",
|
|
@@ -321,6 +321,10 @@ var frameworkOptions = [
|
|
|
321
321
|
label: import_picocolors.default.green("Vue"),
|
|
322
322
|
value: "vue"
|
|
323
323
|
},
|
|
324
|
+
{
|
|
325
|
+
label: import_picocolors.default.red("Nest"),
|
|
326
|
+
value: "nest"
|
|
327
|
+
},
|
|
324
328
|
{
|
|
325
329
|
label: import_picocolors.default.red("Svelte"),
|
|
326
330
|
value: "svelte"
|
|
@@ -491,10 +495,18 @@ async function updateEslintFiles(result) {
|
|
|
491
495
|
configLines.push(`unocss: true,`);
|
|
492
496
|
}
|
|
493
497
|
for (const framework of result.frameworks) {
|
|
494
|
-
|
|
498
|
+
if (framework !== "nest") {
|
|
499
|
+
configLines.push(`${framework}: true,`);
|
|
500
|
+
}
|
|
495
501
|
}
|
|
496
502
|
const mainConfig = configLines.map((i) => ` ${i}`).join("\n");
|
|
497
503
|
const additionalConfig = [];
|
|
504
|
+
if (result.frameworks.includes("nest")) {
|
|
505
|
+
additionalConfig.push(` rules: {
|
|
506
|
+
'ts/consistent-type-imports': 'off'
|
|
507
|
+
}
|
|
508
|
+
`);
|
|
509
|
+
}
|
|
498
510
|
const eslintConfigContent = getEslintConfigContent(mainConfig, additionalConfig);
|
|
499
511
|
await import_promises2.default.writeFile(pathFlatConfig, eslintConfigContent);
|
|
500
512
|
p2.log.success(import_picocolors3.default.green(`Created ${configFileName}`));
|
package/dist/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ import c from "picocolors";
|
|
|
19
19
|
var package_default = {
|
|
20
20
|
name: "@dhzh/eslint-config",
|
|
21
21
|
type: "module",
|
|
22
|
-
version: "0.
|
|
22
|
+
version: "0.5.0",
|
|
23
23
|
packageManager: "pnpm@9.1.0",
|
|
24
24
|
description: "Easton's ESLint config",
|
|
25
25
|
author: "Easton Zheng <dhzhme@gmail.com>",
|
|
@@ -101,7 +101,7 @@ var package_default = {
|
|
|
101
101
|
"@antfu/install-pkg": "^0.3.3",
|
|
102
102
|
"@clack/prompts": "^0.7.0",
|
|
103
103
|
"@eslint-react/eslint-plugin": "^1.5.11",
|
|
104
|
-
"@stylistic/eslint-plugin": "^2.
|
|
104
|
+
"@stylistic/eslint-plugin": "^2.1.0",
|
|
105
105
|
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
|
106
106
|
"@typescript-eslint/parser": "^7.8.0",
|
|
107
107
|
"eslint-config-flat-gitignore": "^0.1.5",
|
|
@@ -123,7 +123,7 @@ var package_default = {
|
|
|
123
123
|
"eslint-plugin-unicorn": "^52.0.0",
|
|
124
124
|
"eslint-plugin-unused-imports": "^3.2.0",
|
|
125
125
|
"eslint-plugin-vitest": "^0.5.4",
|
|
126
|
-
"eslint-plugin-vue": "^9.
|
|
126
|
+
"eslint-plugin-vue": "^9.26.0",
|
|
127
127
|
"eslint-plugin-yml": "^1.14.0",
|
|
128
128
|
"eslint-processor-vue-blocks": "^0.1.2",
|
|
129
129
|
globals: "^15.1.0",
|
|
@@ -140,13 +140,13 @@ var package_default = {
|
|
|
140
140
|
"@antfu/ni": "^0.21.12",
|
|
141
141
|
"@dhzh/eslint-config": "workspace:*",
|
|
142
142
|
"@eslint/config-inspector": "^0.4.8",
|
|
143
|
-
"@stylistic/eslint-plugin-migrate": "^2.
|
|
143
|
+
"@stylistic/eslint-plugin-migrate": "^2.1.0",
|
|
144
144
|
"@types/eslint": "^8.56.10",
|
|
145
145
|
"@types/fs-extra": "^11.0.4",
|
|
146
146
|
"@types/node": "^20.12.11",
|
|
147
147
|
"@types/prompts": "^2.4.9",
|
|
148
148
|
"@types/yargs": "^17.0.32",
|
|
149
|
-
"@unocss/eslint-plugin": "^0.
|
|
149
|
+
"@unocss/eslint-plugin": "^0.60.0",
|
|
150
150
|
"astro-eslint-parser": "^1.0.2",
|
|
151
151
|
bumpp: "^9.4.1",
|
|
152
152
|
"bundle-require": "^4.1.0",
|
|
@@ -157,7 +157,7 @@ var package_default = {
|
|
|
157
157
|
"eslint-plugin-svelte": "^2.38.0",
|
|
158
158
|
"eslint-typegen": "^0.2.4",
|
|
159
159
|
esno: "^4.7.0",
|
|
160
|
-
execa: "^
|
|
160
|
+
execa: "^9.0.0",
|
|
161
161
|
"fast-glob": "^3.3.2",
|
|
162
162
|
"fs-extra": "^11.2.0",
|
|
163
163
|
"lint-staged": "^15.2.2",
|
|
@@ -166,7 +166,7 @@ var package_default = {
|
|
|
166
166
|
rimraf: "^5.0.5",
|
|
167
167
|
"simple-git-hooks": "^2.11.1",
|
|
168
168
|
svelte: "^4.2.16",
|
|
169
|
-
"svelte-eslint-parser": "^0.
|
|
169
|
+
"svelte-eslint-parser": "^0.36.0",
|
|
170
170
|
tsup: "^8.0.2",
|
|
171
171
|
typescript: "^5.4.5",
|
|
172
172
|
vitest: "^1.6.0",
|
|
@@ -292,6 +292,10 @@ var frameworkOptions = [
|
|
|
292
292
|
label: c.green("Vue"),
|
|
293
293
|
value: "vue"
|
|
294
294
|
},
|
|
295
|
+
{
|
|
296
|
+
label: c.red("Nest"),
|
|
297
|
+
value: "nest"
|
|
298
|
+
},
|
|
295
299
|
{
|
|
296
300
|
label: c.red("Svelte"),
|
|
297
301
|
value: "svelte"
|
|
@@ -462,10 +466,18 @@ async function updateEslintFiles(result) {
|
|
|
462
466
|
configLines.push(`unocss: true,`);
|
|
463
467
|
}
|
|
464
468
|
for (const framework of result.frameworks) {
|
|
465
|
-
|
|
469
|
+
if (framework !== "nest") {
|
|
470
|
+
configLines.push(`${framework}: true,`);
|
|
471
|
+
}
|
|
466
472
|
}
|
|
467
473
|
const mainConfig = configLines.map((i) => ` ${i}`).join("\n");
|
|
468
474
|
const additionalConfig = [];
|
|
475
|
+
if (result.frameworks.includes("nest")) {
|
|
476
|
+
additionalConfig.push(` rules: {
|
|
477
|
+
'ts/consistent-type-imports': 'off'
|
|
478
|
+
}
|
|
479
|
+
`);
|
|
480
|
+
}
|
|
469
481
|
const eslintConfigContent = getEslintConfigContent(mainConfig, additionalConfig);
|
|
470
482
|
await fsp2.writeFile(pathFlatConfig, eslintConfigContent);
|
|
471
483
|
p2.log.success(c3.green(`Created ${configFileName}`));
|
package/dist/index.d.cts
CHANGED
|
@@ -3562,6 +3562,11 @@ interface RuleOptions {
|
|
|
3562
3562
|
* @see https://eslint.style/rules/ts/keyword-spacing
|
|
3563
3563
|
*/
|
|
3564
3564
|
'style/keyword-spacing'?: Linter.RuleEntry<StyleKeywordSpacing>
|
|
3565
|
+
/**
|
|
3566
|
+
* Enforce position of line comments
|
|
3567
|
+
* @see https://eslint.style/rules/js/line-comment-position
|
|
3568
|
+
*/
|
|
3569
|
+
'style/line-comment-position'?: Linter.RuleEntry<StyleLineCommentPosition>
|
|
3565
3570
|
/**
|
|
3566
3571
|
* Enforce consistent linebreak style
|
|
3567
3572
|
* @see https://eslint.style/rules/js/linebreak-style
|
|
@@ -3592,6 +3597,11 @@ interface RuleOptions {
|
|
|
3592
3597
|
* @see https://eslint.style/rules/ts/member-delimiter-style
|
|
3593
3598
|
*/
|
|
3594
3599
|
'style/member-delimiter-style'?: Linter.RuleEntry<StyleMemberDelimiterStyle>
|
|
3600
|
+
/**
|
|
3601
|
+
* Enforce a particular style for multiline comments
|
|
3602
|
+
* @see https://eslint.style/rules/js/multiline-comment-style
|
|
3603
|
+
*/
|
|
3604
|
+
'style/multiline-comment-style'?: Linter.RuleEntry<StyleMultilineCommentStyle>
|
|
3595
3605
|
/**
|
|
3596
3606
|
* Enforce newlines between operands of ternary expressions
|
|
3597
3607
|
* @see https://eslint.style/rules/js/multiline-ternary
|
|
@@ -10803,6 +10813,13 @@ type StyleKeywordSpacing = []|[{
|
|
|
10803
10813
|
}
|
|
10804
10814
|
}
|
|
10805
10815
|
}]
|
|
10816
|
+
// ----- style/line-comment-position -----
|
|
10817
|
+
type StyleLineCommentPosition = []|[(("above" | "beside") | {
|
|
10818
|
+
position?: ("above" | "beside")
|
|
10819
|
+
ignorePattern?: string
|
|
10820
|
+
applyDefaultPatterns?: boolean
|
|
10821
|
+
applyDefaultIgnorePatterns?: boolean
|
|
10822
|
+
})]
|
|
10806
10823
|
// ----- style/linebreak-style -----
|
|
10807
10824
|
type StyleLinebreakStyle = []|[("unix" | "windows")]
|
|
10808
10825
|
// ----- style/lines-around-comment -----
|
|
@@ -10956,6 +10973,10 @@ interface _StyleMemberDelimiterStyle_DelimiterConfig {
|
|
|
10956
10973
|
requireLast?: boolean
|
|
10957
10974
|
}
|
|
10958
10975
|
}
|
|
10976
|
+
// ----- style/multiline-comment-style -----
|
|
10977
|
+
type StyleMultilineCommentStyle = ([]|[("starred-block" | "bare-block")] | []|["separate-lines"]|["separate-lines", {
|
|
10978
|
+
checkJSDoc?: boolean
|
|
10979
|
+
}])
|
|
10959
10980
|
// ----- style/multiline-ternary -----
|
|
10960
10981
|
type StyleMultilineTernary = []|[("always" | "always-multiline" | "never")]|[("always" | "always-multiline" | "never"), {
|
|
10961
10982
|
ignoreJSX?: boolean
|
package/dist/index.d.ts
CHANGED
|
@@ -3562,6 +3562,11 @@ interface RuleOptions {
|
|
|
3562
3562
|
* @see https://eslint.style/rules/ts/keyword-spacing
|
|
3563
3563
|
*/
|
|
3564
3564
|
'style/keyword-spacing'?: Linter.RuleEntry<StyleKeywordSpacing>
|
|
3565
|
+
/**
|
|
3566
|
+
* Enforce position of line comments
|
|
3567
|
+
* @see https://eslint.style/rules/js/line-comment-position
|
|
3568
|
+
*/
|
|
3569
|
+
'style/line-comment-position'?: Linter.RuleEntry<StyleLineCommentPosition>
|
|
3565
3570
|
/**
|
|
3566
3571
|
* Enforce consistent linebreak style
|
|
3567
3572
|
* @see https://eslint.style/rules/js/linebreak-style
|
|
@@ -3592,6 +3597,11 @@ interface RuleOptions {
|
|
|
3592
3597
|
* @see https://eslint.style/rules/ts/member-delimiter-style
|
|
3593
3598
|
*/
|
|
3594
3599
|
'style/member-delimiter-style'?: Linter.RuleEntry<StyleMemberDelimiterStyle>
|
|
3600
|
+
/**
|
|
3601
|
+
* Enforce a particular style for multiline comments
|
|
3602
|
+
* @see https://eslint.style/rules/js/multiline-comment-style
|
|
3603
|
+
*/
|
|
3604
|
+
'style/multiline-comment-style'?: Linter.RuleEntry<StyleMultilineCommentStyle>
|
|
3595
3605
|
/**
|
|
3596
3606
|
* Enforce newlines between operands of ternary expressions
|
|
3597
3607
|
* @see https://eslint.style/rules/js/multiline-ternary
|
|
@@ -10803,6 +10813,13 @@ type StyleKeywordSpacing = []|[{
|
|
|
10803
10813
|
}
|
|
10804
10814
|
}
|
|
10805
10815
|
}]
|
|
10816
|
+
// ----- style/line-comment-position -----
|
|
10817
|
+
type StyleLineCommentPosition = []|[(("above" | "beside") | {
|
|
10818
|
+
position?: ("above" | "beside")
|
|
10819
|
+
ignorePattern?: string
|
|
10820
|
+
applyDefaultPatterns?: boolean
|
|
10821
|
+
applyDefaultIgnorePatterns?: boolean
|
|
10822
|
+
})]
|
|
10806
10823
|
// ----- style/linebreak-style -----
|
|
10807
10824
|
type StyleLinebreakStyle = []|[("unix" | "windows")]
|
|
10808
10825
|
// ----- style/lines-around-comment -----
|
|
@@ -10956,6 +10973,10 @@ interface _StyleMemberDelimiterStyle_DelimiterConfig {
|
|
|
10956
10973
|
requireLast?: boolean
|
|
10957
10974
|
}
|
|
10958
10975
|
}
|
|
10976
|
+
// ----- style/multiline-comment-style -----
|
|
10977
|
+
type StyleMultilineCommentStyle = ([]|[("starred-block" | "bare-block")] | []|["separate-lines"]|["separate-lines", {
|
|
10978
|
+
checkJSDoc?: boolean
|
|
10979
|
+
}])
|
|
10959
10980
|
// ----- style/multiline-ternary -----
|
|
10960
10981
|
type StyleMultilineTernary = []|[("always" | "always-multiline" | "never")]|[("always" | "always-multiline" | "never"), {
|
|
10961
10982
|
ignoreJSX?: boolean
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhzh/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"description": "Easton's ESLint config",
|
|
6
6
|
"author": "Easton Zheng <dhzhme@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@antfu/install-pkg": "^0.3.3",
|
|
69
69
|
"@clack/prompts": "^0.7.0",
|
|
70
70
|
"@eslint-react/eslint-plugin": "^1.5.11",
|
|
71
|
-
"@stylistic/eslint-plugin": "^2.
|
|
71
|
+
"@stylistic/eslint-plugin": "^2.1.0",
|
|
72
72
|
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
|
73
73
|
"@typescript-eslint/parser": "^7.8.0",
|
|
74
74
|
"eslint-config-flat-gitignore": "^0.1.5",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"eslint-plugin-unicorn": "^52.0.0",
|
|
91
91
|
"eslint-plugin-unused-imports": "^3.2.0",
|
|
92
92
|
"eslint-plugin-vitest": "^0.5.4",
|
|
93
|
-
"eslint-plugin-vue": "^9.
|
|
93
|
+
"eslint-plugin-vue": "^9.26.0",
|
|
94
94
|
"eslint-plugin-yml": "^1.14.0",
|
|
95
95
|
"eslint-processor-vue-blocks": "^0.1.2",
|
|
96
96
|
"globals": "^15.1.0",
|
|
@@ -106,13 +106,13 @@
|
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"@antfu/ni": "^0.21.12",
|
|
108
108
|
"@eslint/config-inspector": "^0.4.8",
|
|
109
|
-
"@stylistic/eslint-plugin-migrate": "^2.
|
|
109
|
+
"@stylistic/eslint-plugin-migrate": "^2.1.0",
|
|
110
110
|
"@types/eslint": "^8.56.10",
|
|
111
111
|
"@types/fs-extra": "^11.0.4",
|
|
112
112
|
"@types/node": "^20.12.11",
|
|
113
113
|
"@types/prompts": "^2.4.9",
|
|
114
114
|
"@types/yargs": "^17.0.32",
|
|
115
|
-
"@unocss/eslint-plugin": "^0.
|
|
115
|
+
"@unocss/eslint-plugin": "^0.60.0",
|
|
116
116
|
"astro-eslint-parser": "^1.0.2",
|
|
117
117
|
"bumpp": "^9.4.1",
|
|
118
118
|
"bundle-require": "^4.1.0",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"eslint-plugin-svelte": "^2.38.0",
|
|
124
124
|
"eslint-typegen": "^0.2.4",
|
|
125
125
|
"esno": "^4.7.0",
|
|
126
|
-
"execa": "^
|
|
126
|
+
"execa": "^9.0.0",
|
|
127
127
|
"fast-glob": "^3.3.2",
|
|
128
128
|
"fs-extra": "^11.2.0",
|
|
129
129
|
"lint-staged": "^15.2.2",
|
|
@@ -132,12 +132,12 @@
|
|
|
132
132
|
"rimraf": "^5.0.5",
|
|
133
133
|
"simple-git-hooks": "^2.11.1",
|
|
134
134
|
"svelte": "^4.2.16",
|
|
135
|
-
"svelte-eslint-parser": "^0.
|
|
135
|
+
"svelte-eslint-parser": "^0.36.0",
|
|
136
136
|
"tsup": "^8.0.2",
|
|
137
137
|
"typescript": "^5.4.5",
|
|
138
138
|
"vitest": "^1.6.0",
|
|
139
139
|
"vue": "^3.4.27",
|
|
140
|
-
"@dhzh/eslint-config": "0.
|
|
140
|
+
"@dhzh/eslint-config": "0.5.0"
|
|
141
141
|
},
|
|
142
142
|
"simple-git-hooks": {
|
|
143
143
|
"pre-commit": "pnpm lint-staged"
|