@dhzh/eslint-config 0.12.4 → 0.13.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 +2 -0
- package/dist/cli.cjs +23 -22
- package/dist/cli.js +23 -22
- package/dist/index.cjs +83 -53
- package/dist/index.d.cts +131 -59
- package/dist/index.d.ts +131 -59
- package/dist/index.js +81 -52
- package/package.json +22 -21
package/README.md
CHANGED
|
@@ -20,6 +20,8 @@ Differences from [@antfu/eslint-config](https://github.com/antfu/eslint-config/b
|
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
|
+
> Requires ESLint v9.5.0+
|
|
24
|
+
|
|
23
25
|
### Starter Wizard
|
|
24
26
|
|
|
25
27
|
We provided a CLI tool to help you set up your project, or migrate from the legacy config to the new flat config with one command.
|
package/dist/cli.cjs
CHANGED
|
@@ -48,8 +48,8 @@ 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.
|
|
52
|
-
packageManager: "pnpm@9.
|
|
51
|
+
version: "0.13.0",
|
|
52
|
+
packageManager: "pnpm@9.9.0",
|
|
53
53
|
description: "Easton's ESLint config",
|
|
54
54
|
author: "Easton Zheng <dhzhme@gmail.com>",
|
|
55
55
|
license: "MIT",
|
|
@@ -88,7 +88,7 @@ var package_default = {
|
|
|
88
88
|
"@prettier/plugin-xml": "^3.4.1",
|
|
89
89
|
"@unocss/eslint-plugin": ">=0.50.0",
|
|
90
90
|
"astro-eslint-parser": "^1.0.2",
|
|
91
|
-
eslint: "
|
|
91
|
+
eslint: "^9.5.0",
|
|
92
92
|
"eslint-plugin-astro": "^1.2.0",
|
|
93
93
|
"eslint-plugin-format": ">=0.1.0",
|
|
94
94
|
"eslint-plugin-solid": "^0.13.2",
|
|
@@ -130,26 +130,26 @@ var package_default = {
|
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
132
|
dependencies: {
|
|
133
|
-
"@antfu/install-pkg": "^0.4.
|
|
133
|
+
"@antfu/install-pkg": "^0.4.1",
|
|
134
134
|
"@clack/prompts": "^0.7.0",
|
|
135
135
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
|
|
136
|
-
"@eslint-react/eslint-plugin": "^1.12.
|
|
137
|
-
"@stylistic/eslint-plugin": "^2.6.
|
|
138
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
139
|
-
"@typescript-eslint/parser": "^8.
|
|
140
|
-
"@vitest/eslint-plugin": "^1.0
|
|
141
|
-
"eslint-config-flat-gitignore": "^0.
|
|
136
|
+
"@eslint-react/eslint-plugin": "^1.12.3",
|
|
137
|
+
"@stylistic/eslint-plugin": "^2.6.5",
|
|
138
|
+
"@typescript-eslint/eslint-plugin": "^8.3.0",
|
|
139
|
+
"@typescript-eslint/parser": "^8.3.0",
|
|
140
|
+
"@vitest/eslint-plugin": "^1.1.0",
|
|
141
|
+
"eslint-config-flat-gitignore": "^0.3.0",
|
|
142
142
|
"eslint-flat-config-utils": "^0.3.1",
|
|
143
143
|
"eslint-merge-processors": "^0.1.0",
|
|
144
144
|
"eslint-plugin-antfu": "^2.3.6",
|
|
145
145
|
"eslint-plugin-command": "^0.2.3",
|
|
146
|
-
"eslint-plugin-import-x": "^
|
|
146
|
+
"eslint-plugin-import-x": "^4.1.0",
|
|
147
147
|
"eslint-plugin-jsdoc": "^50.2.2",
|
|
148
148
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
149
149
|
"eslint-plugin-markdown": "^5.1.0",
|
|
150
150
|
"eslint-plugin-n": "^17.10.2",
|
|
151
151
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
152
|
-
"eslint-plugin-perfectionist": "^3.
|
|
152
|
+
"eslint-plugin-perfectionist": "^3.3.0",
|
|
153
153
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
154
154
|
"eslint-plugin-react-refresh": "^0.4.11",
|
|
155
155
|
"eslint-plugin-regexp": "^2.6.0",
|
|
@@ -170,20 +170,20 @@ var package_default = {
|
|
|
170
170
|
yargs: "^17.7.2"
|
|
171
171
|
},
|
|
172
172
|
devDependencies: {
|
|
173
|
-
"@antfu/ni": "^0.
|
|
173
|
+
"@antfu/ni": "^0.23.0",
|
|
174
174
|
"@eslint/config-inspector": "^0.5.4",
|
|
175
175
|
"@prettier/plugin-xml": "^3.4.1",
|
|
176
|
-
"@stylistic/eslint-plugin-migrate": "^2.6.
|
|
177
|
-
"@types/eslint": "^9.6.
|
|
176
|
+
"@stylistic/eslint-plugin-migrate": "^2.6.5",
|
|
177
|
+
"@types/eslint": "^9.6.1",
|
|
178
178
|
"@types/fs-extra": "^11.0.4",
|
|
179
|
-
"@types/node": "^22.5.
|
|
179
|
+
"@types/node": "^22.5.1",
|
|
180
180
|
"@types/prompts": "^2.4.9",
|
|
181
181
|
"@types/yargs": "^17.0.33",
|
|
182
|
-
"@unocss/eslint-plugin": "^0.62.
|
|
182
|
+
"@unocss/eslint-plugin": "^0.62.3",
|
|
183
183
|
"astro-eslint-parser": "^1.0.2",
|
|
184
184
|
bumpp: "^9.5.2",
|
|
185
185
|
"bundle-require": "^5.0.0",
|
|
186
|
-
eslint: "^9.9.
|
|
186
|
+
eslint: "^9.9.1",
|
|
187
187
|
"eslint-plugin-astro": "^1.2.3",
|
|
188
188
|
"eslint-plugin-format": "^0.1.2",
|
|
189
189
|
"eslint-plugin-solid": "^0.14.2",
|
|
@@ -199,18 +199,19 @@ var package_default = {
|
|
|
199
199
|
"prettier-plugin-slidev": "^1.0.5",
|
|
200
200
|
rimraf: "^6.0.1",
|
|
201
201
|
"simple-git-hooks": "^2.11.1",
|
|
202
|
-
svelte: "^4.2.
|
|
202
|
+
svelte: "^4.2.19",
|
|
203
203
|
"svelte-eslint-parser": "^0.41.0",
|
|
204
204
|
tsup: "^8.2.4",
|
|
205
|
-
tsx: "^4.
|
|
205
|
+
tsx: "^4.19.0",
|
|
206
206
|
typescript: "^5.5.4",
|
|
207
207
|
vitest: "^2.0.5",
|
|
208
208
|
vue: "^3.4.38"
|
|
209
209
|
},
|
|
210
210
|
resolutions: {
|
|
211
211
|
"@eslint-community/eslint-utils": "^4.4.0",
|
|
212
|
-
"@typescript-eslint/utils": "^8.
|
|
213
|
-
|
|
212
|
+
"@typescript-eslint/utils": "^8.3.0",
|
|
213
|
+
eslint: "^9.9.1",
|
|
214
|
+
tsx: "^4.19.0"
|
|
214
215
|
},
|
|
215
216
|
"simple-git-hooks": {
|
|
216
217
|
"pre-commit": "npx lint-staged"
|
package/dist/cli.js
CHANGED
|
@@ -19,8 +19,8 @@ import c from "picocolors";
|
|
|
19
19
|
var package_default = {
|
|
20
20
|
name: "@dhzh/eslint-config",
|
|
21
21
|
type: "module",
|
|
22
|
-
version: "0.
|
|
23
|
-
packageManager: "pnpm@9.
|
|
22
|
+
version: "0.13.0",
|
|
23
|
+
packageManager: "pnpm@9.9.0",
|
|
24
24
|
description: "Easton's ESLint config",
|
|
25
25
|
author: "Easton Zheng <dhzhme@gmail.com>",
|
|
26
26
|
license: "MIT",
|
|
@@ -59,7 +59,7 @@ var package_default = {
|
|
|
59
59
|
"@prettier/plugin-xml": "^3.4.1",
|
|
60
60
|
"@unocss/eslint-plugin": ">=0.50.0",
|
|
61
61
|
"astro-eslint-parser": "^1.0.2",
|
|
62
|
-
eslint: "
|
|
62
|
+
eslint: "^9.5.0",
|
|
63
63
|
"eslint-plugin-astro": "^1.2.0",
|
|
64
64
|
"eslint-plugin-format": ">=0.1.0",
|
|
65
65
|
"eslint-plugin-solid": "^0.13.2",
|
|
@@ -101,26 +101,26 @@ var package_default = {
|
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
dependencies: {
|
|
104
|
-
"@antfu/install-pkg": "^0.4.
|
|
104
|
+
"@antfu/install-pkg": "^0.4.1",
|
|
105
105
|
"@clack/prompts": "^0.7.0",
|
|
106
106
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
|
|
107
|
-
"@eslint-react/eslint-plugin": "^1.12.
|
|
108
|
-
"@stylistic/eslint-plugin": "^2.6.
|
|
109
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
110
|
-
"@typescript-eslint/parser": "^8.
|
|
111
|
-
"@vitest/eslint-plugin": "^1.0
|
|
112
|
-
"eslint-config-flat-gitignore": "^0.
|
|
107
|
+
"@eslint-react/eslint-plugin": "^1.12.3",
|
|
108
|
+
"@stylistic/eslint-plugin": "^2.6.5",
|
|
109
|
+
"@typescript-eslint/eslint-plugin": "^8.3.0",
|
|
110
|
+
"@typescript-eslint/parser": "^8.3.0",
|
|
111
|
+
"@vitest/eslint-plugin": "^1.1.0",
|
|
112
|
+
"eslint-config-flat-gitignore": "^0.3.0",
|
|
113
113
|
"eslint-flat-config-utils": "^0.3.1",
|
|
114
114
|
"eslint-merge-processors": "^0.1.0",
|
|
115
115
|
"eslint-plugin-antfu": "^2.3.6",
|
|
116
116
|
"eslint-plugin-command": "^0.2.3",
|
|
117
|
-
"eslint-plugin-import-x": "^
|
|
117
|
+
"eslint-plugin-import-x": "^4.1.0",
|
|
118
118
|
"eslint-plugin-jsdoc": "^50.2.2",
|
|
119
119
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
120
120
|
"eslint-plugin-markdown": "^5.1.0",
|
|
121
121
|
"eslint-plugin-n": "^17.10.2",
|
|
122
122
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
123
|
-
"eslint-plugin-perfectionist": "^3.
|
|
123
|
+
"eslint-plugin-perfectionist": "^3.3.0",
|
|
124
124
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
125
125
|
"eslint-plugin-react-refresh": "^0.4.11",
|
|
126
126
|
"eslint-plugin-regexp": "^2.6.0",
|
|
@@ -141,20 +141,20 @@ var package_default = {
|
|
|
141
141
|
yargs: "^17.7.2"
|
|
142
142
|
},
|
|
143
143
|
devDependencies: {
|
|
144
|
-
"@antfu/ni": "^0.
|
|
144
|
+
"@antfu/ni": "^0.23.0",
|
|
145
145
|
"@eslint/config-inspector": "^0.5.4",
|
|
146
146
|
"@prettier/plugin-xml": "^3.4.1",
|
|
147
|
-
"@stylistic/eslint-plugin-migrate": "^2.6.
|
|
148
|
-
"@types/eslint": "^9.6.
|
|
147
|
+
"@stylistic/eslint-plugin-migrate": "^2.6.5",
|
|
148
|
+
"@types/eslint": "^9.6.1",
|
|
149
149
|
"@types/fs-extra": "^11.0.4",
|
|
150
|
-
"@types/node": "^22.5.
|
|
150
|
+
"@types/node": "^22.5.1",
|
|
151
151
|
"@types/prompts": "^2.4.9",
|
|
152
152
|
"@types/yargs": "^17.0.33",
|
|
153
|
-
"@unocss/eslint-plugin": "^0.62.
|
|
153
|
+
"@unocss/eslint-plugin": "^0.62.3",
|
|
154
154
|
"astro-eslint-parser": "^1.0.2",
|
|
155
155
|
bumpp: "^9.5.2",
|
|
156
156
|
"bundle-require": "^5.0.0",
|
|
157
|
-
eslint: "^9.9.
|
|
157
|
+
eslint: "^9.9.1",
|
|
158
158
|
"eslint-plugin-astro": "^1.2.3",
|
|
159
159
|
"eslint-plugin-format": "^0.1.2",
|
|
160
160
|
"eslint-plugin-solid": "^0.14.2",
|
|
@@ -170,18 +170,19 @@ var package_default = {
|
|
|
170
170
|
"prettier-plugin-slidev": "^1.0.5",
|
|
171
171
|
rimraf: "^6.0.1",
|
|
172
172
|
"simple-git-hooks": "^2.11.1",
|
|
173
|
-
svelte: "^4.2.
|
|
173
|
+
svelte: "^4.2.19",
|
|
174
174
|
"svelte-eslint-parser": "^0.41.0",
|
|
175
175
|
tsup: "^8.2.4",
|
|
176
|
-
tsx: "^4.
|
|
176
|
+
tsx: "^4.19.0",
|
|
177
177
|
typescript: "^5.5.4",
|
|
178
178
|
vitest: "^2.0.5",
|
|
179
179
|
vue: "^3.4.38"
|
|
180
180
|
},
|
|
181
181
|
resolutions: {
|
|
182
182
|
"@eslint-community/eslint-utils": "^4.4.0",
|
|
183
|
-
"@typescript-eslint/utils": "^8.
|
|
184
|
-
|
|
183
|
+
"@typescript-eslint/utils": "^8.3.0",
|
|
184
|
+
eslint: "^9.9.1",
|
|
185
|
+
tsx: "^4.19.0"
|
|
185
186
|
},
|
|
186
187
|
"simple-git-hooks": {
|
|
187
188
|
"pre-commit": "npx lint-staged"
|
package/dist/index.cjs
CHANGED
|
@@ -52,6 +52,7 @@ __export(src_exports, {
|
|
|
52
52
|
GLOB_SRC_EXT: () => GLOB_SRC_EXT,
|
|
53
53
|
GLOB_STYLE: () => GLOB_STYLE,
|
|
54
54
|
GLOB_SVELTE: () => GLOB_SVELTE,
|
|
55
|
+
GLOB_SVG: () => GLOB_SVG,
|
|
55
56
|
GLOB_TESTS: () => GLOB_TESTS,
|
|
56
57
|
GLOB_TOML: () => GLOB_TOML,
|
|
57
58
|
GLOB_TS: () => GLOB_TS,
|
|
@@ -105,7 +106,7 @@ __export(src_exports, {
|
|
|
105
106
|
});
|
|
106
107
|
module.exports = __toCommonJS(src_exports);
|
|
107
108
|
|
|
108
|
-
// node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.39_tsx@4.
|
|
109
|
+
// node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.39_tsx@4.19.0_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js
|
|
109
110
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
110
111
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
111
112
|
|
|
@@ -135,6 +136,7 @@ var GLOB_VUE = "**/*.vue";
|
|
|
135
136
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
136
137
|
var GLOB_TOML = "**/*.toml";
|
|
137
138
|
var GLOB_XML = "**/*.xml";
|
|
139
|
+
var GLOB_SVG = "**/*.svg";
|
|
138
140
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
139
141
|
var GLOB_ASTRO = "**/*.astro";
|
|
140
142
|
var GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
@@ -452,6 +454,7 @@ async function stylistic(options = {}) {
|
|
|
452
454
|
// src/configs/formatters.ts
|
|
453
455
|
async function formatters(options = {}, stylistic2 = {}) {
|
|
454
456
|
if (options === true) {
|
|
457
|
+
const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
|
|
455
458
|
options = {
|
|
456
459
|
astro: isPackageInScope("prettier-plugin-astro"),
|
|
457
460
|
css: true,
|
|
@@ -459,14 +462,15 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
459
462
|
html: true,
|
|
460
463
|
markdown: true,
|
|
461
464
|
slidev: (0, import_local_pkg2.isPackageExists)("@slidev/cli"),
|
|
462
|
-
|
|
465
|
+
svg: isPrettierPluginXmlInScope,
|
|
466
|
+
xml: isPrettierPluginXmlInScope
|
|
463
467
|
};
|
|
464
468
|
}
|
|
465
469
|
await ensurePackages([
|
|
466
470
|
"eslint-plugin-format",
|
|
467
471
|
options.markdown && options.slidev ? "prettier-plugin-slidev" : void 0,
|
|
468
472
|
options.astro ? "prettier-plugin-astro" : void 0,
|
|
469
|
-
options.xml ? "@prettier/plugin-xml" : void 0
|
|
473
|
+
options.xml || options.svg ? "@prettier/plugin-xml" : void 0
|
|
470
474
|
]);
|
|
471
475
|
if (options.slidev && options.markdown !== true && options.markdown !== "prettier") {
|
|
472
476
|
throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
|
|
@@ -508,7 +512,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
508
512
|
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
509
513
|
const configs2 = [
|
|
510
514
|
{
|
|
511
|
-
name: "
|
|
515
|
+
name: "dhzh/formatter/setup",
|
|
512
516
|
plugins: {
|
|
513
517
|
format: pluginFormat
|
|
514
518
|
}
|
|
@@ -521,7 +525,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
521
525
|
languageOptions: {
|
|
522
526
|
parser: parserPlain
|
|
523
527
|
},
|
|
524
|
-
name: "
|
|
528
|
+
name: "dhzh/formatter/css",
|
|
525
529
|
rules: {
|
|
526
530
|
"format/prettier": [
|
|
527
531
|
"error",
|
|
@@ -537,7 +541,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
537
541
|
languageOptions: {
|
|
538
542
|
parser: parserPlain
|
|
539
543
|
},
|
|
540
|
-
name: "
|
|
544
|
+
name: "dhzh/formatter/scss",
|
|
541
545
|
rules: {
|
|
542
546
|
"format/prettier": [
|
|
543
547
|
"error",
|
|
@@ -553,7 +557,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
553
557
|
languageOptions: {
|
|
554
558
|
parser: parserPlain
|
|
555
559
|
},
|
|
556
|
-
name: "
|
|
560
|
+
name: "dhzh/formatter/less",
|
|
557
561
|
rules: {
|
|
558
562
|
"format/prettier": [
|
|
559
563
|
"error",
|
|
@@ -572,7 +576,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
572
576
|
languageOptions: {
|
|
573
577
|
parser: parserPlain
|
|
574
578
|
},
|
|
575
|
-
name: "
|
|
579
|
+
name: "dhzh/formatter/html",
|
|
576
580
|
rules: {
|
|
577
581
|
"format/prettier": [
|
|
578
582
|
"error",
|
|
@@ -590,7 +594,29 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
590
594
|
languageOptions: {
|
|
591
595
|
parser: parserPlain
|
|
592
596
|
},
|
|
593
|
-
name: "
|
|
597
|
+
name: "dhzh/formatter/xml",
|
|
598
|
+
rules: {
|
|
599
|
+
"format/prettier": [
|
|
600
|
+
"error",
|
|
601
|
+
{
|
|
602
|
+
...prettierXmlOptions,
|
|
603
|
+
...prettierOptions,
|
|
604
|
+
parser: "xml",
|
|
605
|
+
plugins: [
|
|
606
|
+
"@prettier/plugin-xml"
|
|
607
|
+
]
|
|
608
|
+
}
|
|
609
|
+
]
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
if (options.svg) {
|
|
614
|
+
configs2.push({
|
|
615
|
+
files: [GLOB_SVG],
|
|
616
|
+
languageOptions: {
|
|
617
|
+
parser: parserPlain
|
|
618
|
+
},
|
|
619
|
+
name: "dhzh/formatter/svg",
|
|
594
620
|
rules: {
|
|
595
621
|
"format/prettier": [
|
|
596
622
|
"error",
|
|
@@ -615,7 +641,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
615
641
|
languageOptions: {
|
|
616
642
|
parser: parserPlain
|
|
617
643
|
},
|
|
618
|
-
name: "
|
|
644
|
+
name: "dhzh/formatter/markdown",
|
|
619
645
|
rules: {
|
|
620
646
|
[`format/${formater}`]: [
|
|
621
647
|
"error",
|
|
@@ -636,7 +662,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
636
662
|
languageOptions: {
|
|
637
663
|
parser: parserPlain
|
|
638
664
|
},
|
|
639
|
-
name: "
|
|
665
|
+
name: "dhzh/formatter/slidev",
|
|
640
666
|
rules: {
|
|
641
667
|
"format/prettier": [
|
|
642
668
|
"error",
|
|
@@ -659,7 +685,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
659
685
|
languageOptions: {
|
|
660
686
|
parser: parserPlain
|
|
661
687
|
},
|
|
662
|
-
name: "
|
|
688
|
+
name: "dhzh/formatter/astro",
|
|
663
689
|
rules: {
|
|
664
690
|
"format/prettier": [
|
|
665
691
|
"error",
|
|
@@ -675,7 +701,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
675
701
|
});
|
|
676
702
|
configs2.push({
|
|
677
703
|
files: [GLOB_ASTRO, GLOB_ASTRO_TS],
|
|
678
|
-
name: "
|
|
704
|
+
name: "dhzh/formatter/astro/disables",
|
|
679
705
|
rules: {
|
|
680
706
|
"style/arrow-parens": "off",
|
|
681
707
|
"style/block-spacing": "off",
|
|
@@ -693,7 +719,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
693
719
|
languageOptions: {
|
|
694
720
|
parser: parserPlain
|
|
695
721
|
},
|
|
696
|
-
name: "
|
|
722
|
+
name: "dhzh/formatter/graphql",
|
|
697
723
|
rules: {
|
|
698
724
|
"format/prettier": [
|
|
699
725
|
"error",
|
|
@@ -709,10 +735,14 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
709
735
|
}
|
|
710
736
|
|
|
711
737
|
// src/configs/ignores.ts
|
|
712
|
-
async function ignores() {
|
|
738
|
+
async function ignores(userIgnores = []) {
|
|
713
739
|
return [
|
|
714
740
|
{
|
|
715
|
-
ignores:
|
|
741
|
+
ignores: [
|
|
742
|
+
...GLOB_EXCLUDE,
|
|
743
|
+
...userIgnores
|
|
744
|
+
],
|
|
745
|
+
name: "dhzh/ignores"
|
|
716
746
|
}
|
|
717
747
|
];
|
|
718
748
|
}
|
|
@@ -868,9 +898,6 @@ async function javascript(options = {}) {
|
|
|
868
898
|
],
|
|
869
899
|
"no-restricted-syntax": [
|
|
870
900
|
"error",
|
|
871
|
-
"DebuggerStatement",
|
|
872
|
-
"LabeledStatement",
|
|
873
|
-
"WithStatement",
|
|
874
901
|
"TSEnumDeclaration[const=true]",
|
|
875
902
|
"TSExportAssignment"
|
|
876
903
|
],
|
|
@@ -2063,40 +2090,32 @@ async function typescript(options = {}) {
|
|
|
2063
2090
|
}
|
|
2064
2091
|
|
|
2065
2092
|
// src/configs/unicorn.ts
|
|
2066
|
-
async function unicorn() {
|
|
2093
|
+
async function unicorn(options = {}) {
|
|
2067
2094
|
return [
|
|
2068
2095
|
{
|
|
2069
|
-
name: "
|
|
2096
|
+
name: "dhzh/unicorn/rules",
|
|
2070
2097
|
plugins: {
|
|
2071
2098
|
unicorn: import_eslint_plugin_unicorn.default
|
|
2072
2099
|
},
|
|
2073
2100
|
rules: {
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
2093
|
-
"unicorn/prefer-number-properties": "error",
|
|
2094
|
-
// String methods startsWith/endsWith instead of more complicated stuff
|
|
2095
|
-
"unicorn/prefer-string-starts-ends-with": "error",
|
|
2096
|
-
// Enforce throwing type error when throwing error while checking typeof
|
|
2097
|
-
"unicorn/prefer-type-error": "error",
|
|
2098
|
-
// Use new when throwing error
|
|
2099
|
-
"unicorn/throw-new-error": "error"
|
|
2101
|
+
...options.allRecommended ? import_eslint_plugin_unicorn.default.configs["flat/recommended"].rules : {
|
|
2102
|
+
"unicorn/consistent-empty-array-spread": "error",
|
|
2103
|
+
"unicorn/consistent-function-scoping": "error",
|
|
2104
|
+
"unicorn/error-message": "error",
|
|
2105
|
+
"unicorn/escape-case": "error",
|
|
2106
|
+
"unicorn/new-for-builtins": "error",
|
|
2107
|
+
"unicorn/no-instanceof-array": "error",
|
|
2108
|
+
"unicorn/no-new-array": "error",
|
|
2109
|
+
"unicorn/no-new-buffer": "error",
|
|
2110
|
+
"unicorn/number-literal-case": "error",
|
|
2111
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
2112
|
+
"unicorn/prefer-includes": "error",
|
|
2113
|
+
"unicorn/prefer-node-protocol": "error",
|
|
2114
|
+
"unicorn/prefer-number-properties": "error",
|
|
2115
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
2116
|
+
"unicorn/prefer-type-error": "error",
|
|
2117
|
+
"unicorn/throw-new-error": "error"
|
|
2118
|
+
}
|
|
2100
2119
|
}
|
|
2101
2120
|
}
|
|
2102
2121
|
];
|
|
@@ -2390,8 +2409,6 @@ async function regexp(options = {}) {
|
|
|
2390
2409
|
// src/factory.ts
|
|
2391
2410
|
var flatConfigProps = [
|
|
2392
2411
|
"name",
|
|
2393
|
-
"files",
|
|
2394
|
-
"ignores",
|
|
2395
2412
|
"languageOptions",
|
|
2396
2413
|
"linterOptions",
|
|
2397
2414
|
"processor",
|
|
@@ -2429,6 +2446,7 @@ function dhzh(options = {}, ...userConfigs) {
|
|
|
2429
2446
|
solid: enableSolid = false,
|
|
2430
2447
|
svelte: enableSvelte = false,
|
|
2431
2448
|
typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
|
|
2449
|
+
unicorn: enableUnicorn = true,
|
|
2432
2450
|
unocss: enableUnoCSS = false,
|
|
2433
2451
|
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
|
|
2434
2452
|
} = options;
|
|
@@ -2446,15 +2464,21 @@ function dhzh(options = {}, ...userConfigs) {
|
|
|
2446
2464
|
const configs2 = [];
|
|
2447
2465
|
if (enableGitignore) {
|
|
2448
2466
|
if (typeof enableGitignore !== "boolean") {
|
|
2449
|
-
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(
|
|
2467
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2468
|
+
name: "dhzh/gitignore",
|
|
2469
|
+
...enableGitignore
|
|
2470
|
+
})]));
|
|
2450
2471
|
} else {
|
|
2451
|
-
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2472
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2473
|
+
name: "dhzh/gitignore",
|
|
2474
|
+
strict: false
|
|
2475
|
+
})]));
|
|
2452
2476
|
}
|
|
2453
2477
|
}
|
|
2454
2478
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2455
2479
|
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2456
2480
|
configs2.push(
|
|
2457
|
-
ignores(),
|
|
2481
|
+
ignores(options.ignores),
|
|
2458
2482
|
javascript({
|
|
2459
2483
|
isInEditor,
|
|
2460
2484
|
overrides: getOverrides(options, "javascript")
|
|
@@ -2467,11 +2491,13 @@ function dhzh(options = {}, ...userConfigs) {
|
|
|
2467
2491
|
imports({
|
|
2468
2492
|
stylistic: stylisticOptions
|
|
2469
2493
|
}),
|
|
2470
|
-
unicorn(),
|
|
2471
2494
|
command(),
|
|
2472
2495
|
// Optional plugins (installed but not enabled by default)
|
|
2473
2496
|
perfectionist()
|
|
2474
2497
|
);
|
|
2498
|
+
if (enableUnicorn) {
|
|
2499
|
+
configs2.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
|
2500
|
+
}
|
|
2475
2501
|
if (enableVue) {
|
|
2476
2502
|
componentExts.push("vue");
|
|
2477
2503
|
}
|
|
@@ -2580,6 +2606,9 @@ function dhzh(options = {}, ...userConfigs) {
|
|
|
2580
2606
|
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
2581
2607
|
));
|
|
2582
2608
|
}
|
|
2609
|
+
if ("files" in options) {
|
|
2610
|
+
throw new Error('[@dhzh/eslint-config] The first argument should not contain the "files" property as the options are supposed to be global. Place it in the second or later config instead.');
|
|
2611
|
+
}
|
|
2583
2612
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
2584
2613
|
if (key in options) {
|
|
2585
2614
|
acc[key] = options[key];
|
|
@@ -2636,6 +2665,7 @@ var src_default = dhzh;
|
|
|
2636
2665
|
GLOB_SRC_EXT,
|
|
2637
2666
|
GLOB_STYLE,
|
|
2638
2667
|
GLOB_SVELTE,
|
|
2668
|
+
GLOB_SVG,
|
|
2639
2669
|
GLOB_TESTS,
|
|
2640
2670
|
GLOB_TOML,
|
|
2641
2671
|
GLOB_TS,
|