@antfu/eslint-config 2.27.3 → 3.1.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 +3 -1
- package/dist/cli.cjs +23 -23
- package/dist/cli.js +23 -23
- package/dist/index.cjs +43 -39
- package/dist/index.d.cts +309 -79
- package/dist/index.d.ts +309 -79
- package/dist/index.js +42 -38
- package/package.json +24 -24
package/README.md
CHANGED
|
@@ -14,10 +14,12 @@
|
|
|
14
14
|
- Single quotes, no semi
|
|
15
15
|
- Using [ESLint Stylistic](https://github.com/eslint-stylistic/eslint-stylistic)
|
|
16
16
|
- Respects `.gitignore` by default
|
|
17
|
-
-
|
|
17
|
+
- Requires ESLint v9.5.0+
|
|
18
18
|
|
|
19
19
|
> [!IMPORTANT]
|
|
20
20
|
> Since v1.0.0, this config is rewritten to the new [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new), check the [release note](https://github.com/antfu/eslint-config/releases/tag/v1.0.0) for more details.
|
|
21
|
+
>
|
|
22
|
+
> Since v3.0.0, ESLint v9.5.0+ is now required.
|
|
21
23
|
|
|
22
24
|
## Usage
|
|
23
25
|
|
package/dist/cli.cjs
CHANGED
|
@@ -48,7 +48,7 @@ var import_picocolors = __toESM(require("picocolors"), 1);
|
|
|
48
48
|
var package_default = {
|
|
49
49
|
name: "@antfu/eslint-config",
|
|
50
50
|
type: "module",
|
|
51
|
-
version: "
|
|
51
|
+
version: "3.1.0",
|
|
52
52
|
packageManager: "pnpm@9.9.0",
|
|
53
53
|
description: "Anthony's ESLint config",
|
|
54
54
|
author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
@@ -90,12 +90,12 @@ var package_default = {
|
|
|
90
90
|
"@prettier/plugin-xml": "^3.4.1",
|
|
91
91
|
"@unocss/eslint-plugin": ">=0.50.0",
|
|
92
92
|
"astro-eslint-parser": "^1.0.2",
|
|
93
|
-
eslint: "
|
|
93
|
+
eslint: "^9.5.0",
|
|
94
94
|
"eslint-plugin-astro": "^1.2.0",
|
|
95
95
|
"eslint-plugin-format": ">=0.1.0",
|
|
96
96
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
97
97
|
"eslint-plugin-react-refresh": "^0.4.4",
|
|
98
|
-
"eslint-plugin-solid": "^0.
|
|
98
|
+
"eslint-plugin-solid": "^0.14.3",
|
|
99
99
|
"eslint-plugin-svelte": ">=2.35.1",
|
|
100
100
|
"prettier-plugin-astro": "^0.13.0",
|
|
101
101
|
"prettier-plugin-slidev": "^1.0.5",
|
|
@@ -146,34 +146,34 @@ var package_default = {
|
|
|
146
146
|
"@antfu/install-pkg": "^0.4.1",
|
|
147
147
|
"@clack/prompts": "^0.7.0",
|
|
148
148
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
|
|
149
|
-
"@stylistic/eslint-plugin": "^2.
|
|
150
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
151
|
-
"@typescript-eslint/parser": "^8.
|
|
152
|
-
"@vitest/eslint-plugin": "^1.0
|
|
153
|
-
"eslint-config-flat-gitignore": "^0.
|
|
149
|
+
"@stylistic/eslint-plugin": "^2.7.2",
|
|
150
|
+
"@typescript-eslint/eslint-plugin": "^8.4.0",
|
|
151
|
+
"@typescript-eslint/parser": "^8.4.0",
|
|
152
|
+
"@vitest/eslint-plugin": "^1.1.0",
|
|
153
|
+
"eslint-config-flat-gitignore": "^0.3.0",
|
|
154
154
|
"eslint-flat-config-utils": "^0.3.1",
|
|
155
155
|
"eslint-merge-processors": "^0.1.0",
|
|
156
|
-
"eslint-plugin-antfu": "^2.
|
|
156
|
+
"eslint-plugin-antfu": "^2.4.1",
|
|
157
157
|
"eslint-plugin-command": "^0.2.3",
|
|
158
|
-
"eslint-plugin-import-x": "^4.
|
|
158
|
+
"eslint-plugin-import-x": "^4.1.1",
|
|
159
159
|
"eslint-plugin-jsdoc": "^50.2.2",
|
|
160
160
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
161
161
|
"eslint-plugin-markdown": "^5.1.0",
|
|
162
162
|
"eslint-plugin-n": "^17.10.2",
|
|
163
163
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
164
|
-
"eslint-plugin-perfectionist": "^3.
|
|
164
|
+
"eslint-plugin-perfectionist": "^3.3.0",
|
|
165
165
|
"eslint-plugin-regexp": "^2.6.0",
|
|
166
166
|
"eslint-plugin-toml": "^0.11.1",
|
|
167
167
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
168
168
|
"eslint-plugin-unused-imports": "^4.1.3",
|
|
169
|
-
"eslint-plugin-vue": "^9.
|
|
169
|
+
"eslint-plugin-vue": "^9.28.0",
|
|
170
170
|
"eslint-plugin-yml": "^1.14.0",
|
|
171
171
|
"eslint-processor-vue-blocks": "^0.1.2",
|
|
172
172
|
globals: "^15.9.0",
|
|
173
173
|
"jsonc-eslint-parser": "^2.4.0",
|
|
174
174
|
"local-pkg": "^0.5.0",
|
|
175
175
|
"parse-gitignore": "^2.0.0",
|
|
176
|
-
picocolors: "^1.0
|
|
176
|
+
picocolors: "^1.1.0",
|
|
177
177
|
"toml-eslint-parser": "^0.10.0",
|
|
178
178
|
"vue-eslint-parser": "^9.4.3",
|
|
179
179
|
"yaml-eslint-parser": "^1.2.3",
|
|
@@ -181,14 +181,14 @@ var package_default = {
|
|
|
181
181
|
},
|
|
182
182
|
devDependencies: {
|
|
183
183
|
"@antfu/eslint-config": "workspace:*",
|
|
184
|
-
"@antfu/ni": "^0.
|
|
185
|
-
"@eslint-react/eslint-plugin": "^1.
|
|
184
|
+
"@antfu/ni": "^0.23.0",
|
|
185
|
+
"@eslint-react/eslint-plugin": "^1.13.0",
|
|
186
186
|
"@eslint/config-inspector": "^0.5.4",
|
|
187
187
|
"@prettier/plugin-xml": "^3.4.1",
|
|
188
|
-
"@stylistic/eslint-plugin-migrate": "^2.
|
|
188
|
+
"@stylistic/eslint-plugin-migrate": "^2.7.2",
|
|
189
189
|
"@types/eslint": "^9.6.1",
|
|
190
190
|
"@types/fs-extra": "^11.0.4",
|
|
191
|
-
"@types/node": "^22.5.
|
|
191
|
+
"@types/node": "^22.5.3",
|
|
192
192
|
"@types/prompts": "^2.4.9",
|
|
193
193
|
"@types/yargs": "^17.0.33",
|
|
194
194
|
"@unocss/eslint-plugin": "^0.62.3",
|
|
@@ -199,7 +199,7 @@ var package_default = {
|
|
|
199
199
|
"eslint-plugin-format": "^0.1.2",
|
|
200
200
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
201
201
|
"eslint-plugin-react-refresh": "^0.4.11",
|
|
202
|
-
"eslint-plugin-solid": "^0.14.
|
|
202
|
+
"eslint-plugin-solid": "^0.14.3",
|
|
203
203
|
"eslint-plugin-svelte": "^2.43.0",
|
|
204
204
|
"eslint-typegen": "^0.3.1",
|
|
205
205
|
esno: "^4.7.0",
|
|
@@ -207,7 +207,7 @@ var package_default = {
|
|
|
207
207
|
"fast-glob": "^3.3.2",
|
|
208
208
|
"fs-extra": "^11.2.0",
|
|
209
209
|
jiti: "^1.21.6",
|
|
210
|
-
"lint-staged": "^15.2.
|
|
210
|
+
"lint-staged": "^15.2.10",
|
|
211
211
|
"prettier-plugin-astro": "^0.14.1",
|
|
212
212
|
"prettier-plugin-slidev": "^1.0.5",
|
|
213
213
|
rimraf: "^6.0.1",
|
|
@@ -215,16 +215,16 @@ var package_default = {
|
|
|
215
215
|
svelte: "^4.2.19",
|
|
216
216
|
"svelte-eslint-parser": "^0.41.0",
|
|
217
217
|
tsup: "^8.2.4",
|
|
218
|
-
tsx: "^4.
|
|
218
|
+
tsx: "^4.19.0",
|
|
219
219
|
typescript: "^5.5.4",
|
|
220
220
|
vitest: "^2.0.5",
|
|
221
|
-
vue: "^3.
|
|
221
|
+
vue: "^3.5.0"
|
|
222
222
|
},
|
|
223
223
|
resolutions: {
|
|
224
224
|
"@eslint-community/eslint-utils": "^4.4.0",
|
|
225
|
-
"@typescript-eslint/utils": "^8.
|
|
225
|
+
"@typescript-eslint/utils": "^8.4.0",
|
|
226
226
|
eslint: "^9.9.1",
|
|
227
|
-
tsx: "^4.
|
|
227
|
+
tsx: "^4.19.0"
|
|
228
228
|
},
|
|
229
229
|
"simple-git-hooks": {
|
|
230
230
|
"pre-commit": "npx lint-staged"
|
package/dist/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ import c from "picocolors";
|
|
|
19
19
|
var package_default = {
|
|
20
20
|
name: "@antfu/eslint-config",
|
|
21
21
|
type: "module",
|
|
22
|
-
version: "
|
|
22
|
+
version: "3.1.0",
|
|
23
23
|
packageManager: "pnpm@9.9.0",
|
|
24
24
|
description: "Anthony's ESLint config",
|
|
25
25
|
author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
@@ -61,12 +61,12 @@ var package_default = {
|
|
|
61
61
|
"@prettier/plugin-xml": "^3.4.1",
|
|
62
62
|
"@unocss/eslint-plugin": ">=0.50.0",
|
|
63
63
|
"astro-eslint-parser": "^1.0.2",
|
|
64
|
-
eslint: "
|
|
64
|
+
eslint: "^9.5.0",
|
|
65
65
|
"eslint-plugin-astro": "^1.2.0",
|
|
66
66
|
"eslint-plugin-format": ">=0.1.0",
|
|
67
67
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
68
68
|
"eslint-plugin-react-refresh": "^0.4.4",
|
|
69
|
-
"eslint-plugin-solid": "^0.
|
|
69
|
+
"eslint-plugin-solid": "^0.14.3",
|
|
70
70
|
"eslint-plugin-svelte": ">=2.35.1",
|
|
71
71
|
"prettier-plugin-astro": "^0.13.0",
|
|
72
72
|
"prettier-plugin-slidev": "^1.0.5",
|
|
@@ -117,34 +117,34 @@ var package_default = {
|
|
|
117
117
|
"@antfu/install-pkg": "^0.4.1",
|
|
118
118
|
"@clack/prompts": "^0.7.0",
|
|
119
119
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
|
|
120
|
-
"@stylistic/eslint-plugin": "^2.
|
|
121
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
122
|
-
"@typescript-eslint/parser": "^8.
|
|
123
|
-
"@vitest/eslint-plugin": "^1.0
|
|
124
|
-
"eslint-config-flat-gitignore": "^0.
|
|
120
|
+
"@stylistic/eslint-plugin": "^2.7.2",
|
|
121
|
+
"@typescript-eslint/eslint-plugin": "^8.4.0",
|
|
122
|
+
"@typescript-eslint/parser": "^8.4.0",
|
|
123
|
+
"@vitest/eslint-plugin": "^1.1.0",
|
|
124
|
+
"eslint-config-flat-gitignore": "^0.3.0",
|
|
125
125
|
"eslint-flat-config-utils": "^0.3.1",
|
|
126
126
|
"eslint-merge-processors": "^0.1.0",
|
|
127
|
-
"eslint-plugin-antfu": "^2.
|
|
127
|
+
"eslint-plugin-antfu": "^2.4.1",
|
|
128
128
|
"eslint-plugin-command": "^0.2.3",
|
|
129
|
-
"eslint-plugin-import-x": "^4.
|
|
129
|
+
"eslint-plugin-import-x": "^4.1.1",
|
|
130
130
|
"eslint-plugin-jsdoc": "^50.2.2",
|
|
131
131
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
132
132
|
"eslint-plugin-markdown": "^5.1.0",
|
|
133
133
|
"eslint-plugin-n": "^17.10.2",
|
|
134
134
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
135
|
-
"eslint-plugin-perfectionist": "^3.
|
|
135
|
+
"eslint-plugin-perfectionist": "^3.3.0",
|
|
136
136
|
"eslint-plugin-regexp": "^2.6.0",
|
|
137
137
|
"eslint-plugin-toml": "^0.11.1",
|
|
138
138
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
139
139
|
"eslint-plugin-unused-imports": "^4.1.3",
|
|
140
|
-
"eslint-plugin-vue": "^9.
|
|
140
|
+
"eslint-plugin-vue": "^9.28.0",
|
|
141
141
|
"eslint-plugin-yml": "^1.14.0",
|
|
142
142
|
"eslint-processor-vue-blocks": "^0.1.2",
|
|
143
143
|
globals: "^15.9.0",
|
|
144
144
|
"jsonc-eslint-parser": "^2.4.0",
|
|
145
145
|
"local-pkg": "^0.5.0",
|
|
146
146
|
"parse-gitignore": "^2.0.0",
|
|
147
|
-
picocolors: "^1.0
|
|
147
|
+
picocolors: "^1.1.0",
|
|
148
148
|
"toml-eslint-parser": "^0.10.0",
|
|
149
149
|
"vue-eslint-parser": "^9.4.3",
|
|
150
150
|
"yaml-eslint-parser": "^1.2.3",
|
|
@@ -152,14 +152,14 @@ var package_default = {
|
|
|
152
152
|
},
|
|
153
153
|
devDependencies: {
|
|
154
154
|
"@antfu/eslint-config": "workspace:*",
|
|
155
|
-
"@antfu/ni": "^0.
|
|
156
|
-
"@eslint-react/eslint-plugin": "^1.
|
|
155
|
+
"@antfu/ni": "^0.23.0",
|
|
156
|
+
"@eslint-react/eslint-plugin": "^1.13.0",
|
|
157
157
|
"@eslint/config-inspector": "^0.5.4",
|
|
158
158
|
"@prettier/plugin-xml": "^3.4.1",
|
|
159
|
-
"@stylistic/eslint-plugin-migrate": "^2.
|
|
159
|
+
"@stylistic/eslint-plugin-migrate": "^2.7.2",
|
|
160
160
|
"@types/eslint": "^9.6.1",
|
|
161
161
|
"@types/fs-extra": "^11.0.4",
|
|
162
|
-
"@types/node": "^22.5.
|
|
162
|
+
"@types/node": "^22.5.3",
|
|
163
163
|
"@types/prompts": "^2.4.9",
|
|
164
164
|
"@types/yargs": "^17.0.33",
|
|
165
165
|
"@unocss/eslint-plugin": "^0.62.3",
|
|
@@ -170,7 +170,7 @@ var package_default = {
|
|
|
170
170
|
"eslint-plugin-format": "^0.1.2",
|
|
171
171
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
172
172
|
"eslint-plugin-react-refresh": "^0.4.11",
|
|
173
|
-
"eslint-plugin-solid": "^0.14.
|
|
173
|
+
"eslint-plugin-solid": "^0.14.3",
|
|
174
174
|
"eslint-plugin-svelte": "^2.43.0",
|
|
175
175
|
"eslint-typegen": "^0.3.1",
|
|
176
176
|
esno: "^4.7.0",
|
|
@@ -178,7 +178,7 @@ var package_default = {
|
|
|
178
178
|
"fast-glob": "^3.3.2",
|
|
179
179
|
"fs-extra": "^11.2.0",
|
|
180
180
|
jiti: "^1.21.6",
|
|
181
|
-
"lint-staged": "^15.2.
|
|
181
|
+
"lint-staged": "^15.2.10",
|
|
182
182
|
"prettier-plugin-astro": "^0.14.1",
|
|
183
183
|
"prettier-plugin-slidev": "^1.0.5",
|
|
184
184
|
rimraf: "^6.0.1",
|
|
@@ -186,16 +186,16 @@ var package_default = {
|
|
|
186
186
|
svelte: "^4.2.19",
|
|
187
187
|
"svelte-eslint-parser": "^0.41.0",
|
|
188
188
|
tsup: "^8.2.4",
|
|
189
|
-
tsx: "^4.
|
|
189
|
+
tsx: "^4.19.0",
|
|
190
190
|
typescript: "^5.5.4",
|
|
191
191
|
vitest: "^2.0.5",
|
|
192
|
-
vue: "^3.
|
|
192
|
+
vue: "^3.5.0"
|
|
193
193
|
},
|
|
194
194
|
resolutions: {
|
|
195
195
|
"@eslint-community/eslint-utils": "^4.4.0",
|
|
196
|
-
"@typescript-eslint/utils": "^8.
|
|
196
|
+
"@typescript-eslint/utils": "^8.4.0",
|
|
197
197
|
eslint: "^9.9.1",
|
|
198
|
-
tsx: "^4.
|
|
198
|
+
tsx: "^4.19.0"
|
|
199
199
|
},
|
|
200
200
|
"simple-git-hooks": {
|
|
201
201
|
"pre-commit": "npx lint-staged"
|
package/dist/index.cjs
CHANGED
|
@@ -106,7 +106,7 @@ __export(src_exports, {
|
|
|
106
106
|
});
|
|
107
107
|
module.exports = __toCommonJS(src_exports);
|
|
108
108
|
|
|
109
|
-
// node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.
|
|
109
|
+
// node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.44_tsx@4.19.0_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js
|
|
110
110
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
111
111
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
112
112
|
|
|
@@ -426,6 +426,7 @@ async function stylistic(options = {}) {
|
|
|
426
426
|
},
|
|
427
427
|
rules: {
|
|
428
428
|
...config.rules,
|
|
429
|
+
"antfu/consistent-chaining": "error",
|
|
429
430
|
"antfu/consistent-list-newline": "error",
|
|
430
431
|
...lessOpinionated ? {
|
|
431
432
|
curly: ["error", "all"]
|
|
@@ -723,10 +724,14 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
723
724
|
}
|
|
724
725
|
|
|
725
726
|
// src/configs/ignores.ts
|
|
726
|
-
async function ignores() {
|
|
727
|
+
async function ignores(userIgnores = []) {
|
|
727
728
|
return [
|
|
728
729
|
{
|
|
729
|
-
ignores:
|
|
730
|
+
ignores: [
|
|
731
|
+
...GLOB_EXCLUDE,
|
|
732
|
+
...userIgnores
|
|
733
|
+
],
|
|
734
|
+
name: "antfu/ignores"
|
|
730
735
|
}
|
|
731
736
|
];
|
|
732
737
|
}
|
|
@@ -882,9 +887,6 @@ async function javascript(options = {}) {
|
|
|
882
887
|
],
|
|
883
888
|
"no-restricted-syntax": [
|
|
884
889
|
"error",
|
|
885
|
-
"DebuggerStatement",
|
|
886
|
-
"LabeledStatement",
|
|
887
|
-
"WithStatement",
|
|
888
890
|
"TSEnumDeclaration[const=true]",
|
|
889
891
|
"TSExportAssignment"
|
|
890
892
|
],
|
|
@@ -2082,7 +2084,7 @@ async function typescript(options = {}) {
|
|
|
2082
2084
|
}
|
|
2083
2085
|
|
|
2084
2086
|
// src/configs/unicorn.ts
|
|
2085
|
-
async function unicorn() {
|
|
2087
|
+
async function unicorn(options = {}) {
|
|
2086
2088
|
return [
|
|
2087
2089
|
{
|
|
2088
2090
|
name: "antfu/unicorn/rules",
|
|
@@ -2090,32 +2092,24 @@ async function unicorn() {
|
|
|
2090
2092
|
unicorn: import_eslint_plugin_unicorn.default
|
|
2091
2093
|
},
|
|
2092
2094
|
rules: {
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
2112
|
-
"unicorn/prefer-number-properties": "error",
|
|
2113
|
-
// String methods startsWith/endsWith instead of more complicated stuff
|
|
2114
|
-
"unicorn/prefer-string-starts-ends-with": "error",
|
|
2115
|
-
// Enforce throwing type error when throwing error while checking typeof
|
|
2116
|
-
"unicorn/prefer-type-error": "error",
|
|
2117
|
-
// Use new when throwing error
|
|
2118
|
-
"unicorn/throw-new-error": "error"
|
|
2095
|
+
...options.allRecommended ? import_eslint_plugin_unicorn.default.configs["flat/recommended"].rules : {
|
|
2096
|
+
"unicorn/consistent-empty-array-spread": "error",
|
|
2097
|
+
"unicorn/consistent-function-scoping": "error",
|
|
2098
|
+
"unicorn/error-message": "error",
|
|
2099
|
+
"unicorn/escape-case": "error",
|
|
2100
|
+
"unicorn/new-for-builtins": "error",
|
|
2101
|
+
"unicorn/no-instanceof-array": "error",
|
|
2102
|
+
"unicorn/no-new-array": "error",
|
|
2103
|
+
"unicorn/no-new-buffer": "error",
|
|
2104
|
+
"unicorn/number-literal-case": "error",
|
|
2105
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
2106
|
+
"unicorn/prefer-includes": "error",
|
|
2107
|
+
"unicorn/prefer-node-protocol": "error",
|
|
2108
|
+
"unicorn/prefer-number-properties": "error",
|
|
2109
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
2110
|
+
"unicorn/prefer-type-error": "error",
|
|
2111
|
+
"unicorn/throw-new-error": "error"
|
|
2112
|
+
}
|
|
2119
2113
|
}
|
|
2120
2114
|
}
|
|
2121
2115
|
];
|
|
@@ -2408,8 +2402,6 @@ async function regexp(options = {}) {
|
|
|
2408
2402
|
// src/factory.ts
|
|
2409
2403
|
var flatConfigProps = [
|
|
2410
2404
|
"name",
|
|
2411
|
-
"files",
|
|
2412
|
-
"ignores",
|
|
2413
2405
|
"languageOptions",
|
|
2414
2406
|
"linterOptions",
|
|
2415
2407
|
"processor",
|
|
@@ -2447,6 +2439,7 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2447
2439
|
solid: enableSolid = false,
|
|
2448
2440
|
svelte: enableSvelte = false,
|
|
2449
2441
|
typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
|
|
2442
|
+
unicorn: enableUnicorn = true,
|
|
2450
2443
|
unocss: enableUnoCSS = false,
|
|
2451
2444
|
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
|
|
2452
2445
|
} = options;
|
|
@@ -2462,15 +2455,21 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2462
2455
|
const configs2 = [];
|
|
2463
2456
|
if (enableGitignore) {
|
|
2464
2457
|
if (typeof enableGitignore !== "boolean") {
|
|
2465
|
-
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(
|
|
2458
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2459
|
+
name: "antfu/gitignore",
|
|
2460
|
+
...enableGitignore
|
|
2461
|
+
})]));
|
|
2466
2462
|
} else {
|
|
2467
|
-
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2463
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2464
|
+
name: "antfu/gitignore",
|
|
2465
|
+
strict: false
|
|
2466
|
+
})]));
|
|
2468
2467
|
}
|
|
2469
2468
|
}
|
|
2470
2469
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2471
2470
|
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2472
2471
|
configs2.push(
|
|
2473
|
-
ignores(),
|
|
2472
|
+
ignores(options.ignores),
|
|
2474
2473
|
javascript({
|
|
2475
2474
|
isInEditor,
|
|
2476
2475
|
overrides: getOverrides(options, "javascript")
|
|
@@ -2483,11 +2482,13 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2483
2482
|
imports({
|
|
2484
2483
|
stylistic: stylisticOptions
|
|
2485
2484
|
}),
|
|
2486
|
-
unicorn(),
|
|
2487
2485
|
command(),
|
|
2488
2486
|
// Optional plugins (installed but not enabled by default)
|
|
2489
2487
|
perfectionist()
|
|
2490
2488
|
);
|
|
2489
|
+
if (enableUnicorn) {
|
|
2490
|
+
configs2.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
|
2491
|
+
}
|
|
2491
2492
|
if (enableVue) {
|
|
2492
2493
|
componentExts.push("vue");
|
|
2493
2494
|
}
|
|
@@ -2596,6 +2597,9 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2596
2597
|
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
2597
2598
|
));
|
|
2598
2599
|
}
|
|
2600
|
+
if ("files" in options) {
|
|
2601
|
+
throw new Error('[@antfu/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.');
|
|
2602
|
+
}
|
|
2599
2603
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
2600
2604
|
if (key in options)
|
|
2601
2605
|
acc[key] = options[key];
|