@antfu/eslint-config 7.6.1 → 7.7.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 +66 -0
- package/dist/cli.mjs +23 -20
- package/dist/index.d.mts +157 -29
- package/dist/index.mjs +34 -10
- package/package.json +21 -20
package/README.md
CHANGED
|
@@ -167,6 +167,72 @@ Add the following settings to your `.vscode/settings.json`:
|
|
|
167
167
|
|
|
168
168
|
</details>
|
|
169
169
|
|
|
170
|
+
<details>
|
|
171
|
+
<summary>🔲 Zed support</summary>
|
|
172
|
+
|
|
173
|
+
<br>
|
|
174
|
+
|
|
175
|
+
Add the following settings to your `.zed/settings.json`:
|
|
176
|
+
|
|
177
|
+
```jsonc
|
|
178
|
+
{
|
|
179
|
+
"format_on_save": "on",
|
|
180
|
+
"formatter": [
|
|
181
|
+
// Use ESLint's --fix:
|
|
182
|
+
{ "code_action": "source.fixAll.eslint" }
|
|
183
|
+
],
|
|
184
|
+
// Enable eslint for all supported languages
|
|
185
|
+
// Defaults only include https://github.com/search?q=repo%3Azed-industries%2Fzed%20eslint_languages&type=code
|
|
186
|
+
"languages": {
|
|
187
|
+
"HTML": {
|
|
188
|
+
"language_servers": ["...", "eslint"]
|
|
189
|
+
},
|
|
190
|
+
"Markdown": {
|
|
191
|
+
"language_servers": ["...", "eslint"]
|
|
192
|
+
},
|
|
193
|
+
"JSON": {
|
|
194
|
+
"language_servers": ["...", "eslint"]
|
|
195
|
+
},
|
|
196
|
+
"JSONC": {
|
|
197
|
+
"language_servers": ["...", "eslint"]
|
|
198
|
+
},
|
|
199
|
+
"YAML": {
|
|
200
|
+
"language_servers": ["...", "eslint"]
|
|
201
|
+
},
|
|
202
|
+
"CSS": {
|
|
203
|
+
"language_servers": ["...", "eslint"]
|
|
204
|
+
}
|
|
205
|
+
// Add other languages as needed
|
|
206
|
+
},
|
|
207
|
+
"lsp": {
|
|
208
|
+
"eslint": {
|
|
209
|
+
"settings": {
|
|
210
|
+
// Remove after https://github.com/zed-industries/zed/issues/49387
|
|
211
|
+
"experimental": {
|
|
212
|
+
"useFlatConfig": false
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
// Silent the stylistic rules in your IDE, but still auto fix them
|
|
216
|
+
"rulesCustomizations": [
|
|
217
|
+
{ "rule": "style/*", "severity": "off", "fixable": true },
|
|
218
|
+
{ "rule": "format/*", "severity": "off", "fixable": true },
|
|
219
|
+
{ "rule": "*-indent", "severity": "off", "fixable": true },
|
|
220
|
+
{ "rule": "*-spacing", "severity": "off", "fixable": true },
|
|
221
|
+
{ "rule": "*-spaces", "severity": "off", "fixable": true },
|
|
222
|
+
{ "rule": "*-order", "severity": "off", "fixable": true },
|
|
223
|
+
{ "rule": "*-dangle", "severity": "off", "fixable": true },
|
|
224
|
+
{ "rule": "*-newline", "severity": "off", "fixable": true },
|
|
225
|
+
{ "rule": "*quotes", "severity": "off", "fixable": true },
|
|
226
|
+
{ "rule": "*semi", "severity": "off", "fixable": true }
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
</details>
|
|
235
|
+
|
|
170
236
|
<details>
|
|
171
237
|
<summary>🟩 Neovim Support</summary>
|
|
172
238
|
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
|
-
import
|
|
3
|
-
import fs
|
|
2
|
+
import fsPromises from "node:fs/promises";
|
|
3
|
+
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import * as p from "@clack/prompts";
|
|
6
6
|
import c, { green } from "ansis";
|
|
@@ -9,7 +9,7 @@ import parse from "parse-gitignore";
|
|
|
9
9
|
import { execSync } from "node:child_process";
|
|
10
10
|
|
|
11
11
|
//#region package.json
|
|
12
|
-
var version = "7.
|
|
12
|
+
var version = "7.7.0";
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/cli/constants.ts
|
|
@@ -139,17 +139,19 @@ ${mainConfig}
|
|
|
139
139
|
|
|
140
140
|
//#endregion
|
|
141
141
|
//#region src/cli/stages/update-eslint-files.ts
|
|
142
|
+
const ESLINT_OR_PRETTIER = /eslint|prettier/;
|
|
143
|
+
const ESLINT_CONFIG = /eslint\.config\./;
|
|
142
144
|
async function updateEslintFiles(result) {
|
|
143
145
|
const cwd = process.cwd();
|
|
144
146
|
const pathESLintIgnore = path.join(cwd, ".eslintignore");
|
|
145
147
|
const pathPackageJSON = path.join(cwd, "package.json");
|
|
146
|
-
const pkgContent = await
|
|
148
|
+
const pkgContent = await fsPromises.readFile(pathPackageJSON, "utf-8");
|
|
147
149
|
const configFileName = JSON.parse(pkgContent).type === "module" ? "eslint.config.js" : "eslint.config.mjs";
|
|
148
150
|
const pathFlatConfig = path.join(cwd, configFileName);
|
|
149
151
|
const eslintIgnores = [];
|
|
150
|
-
if (fs
|
|
152
|
+
if (fs.existsSync(pathESLintIgnore)) {
|
|
151
153
|
p.log.step(c.cyan`Migrating existing .eslintignore`);
|
|
152
|
-
const globs = parse(await
|
|
154
|
+
const globs = parse(await fsPromises.readFile(pathESLintIgnore, "utf-8")).globs();
|
|
153
155
|
for (const glob of globs) if (glob.type === "ignore") eslintIgnores.push(...glob.patterns);
|
|
154
156
|
else if (glob.type === "unignore") eslintIgnores.push(...glob.patterns.map((pattern) => `!${pattern}`));
|
|
155
157
|
}
|
|
@@ -159,12 +161,12 @@ async function updateEslintFiles(result) {
|
|
|
159
161
|
if (result.extra.includes("unocss")) configLines.push(`unocss: true,`);
|
|
160
162
|
for (const framework of result.frameworks) configLines.push(`${framework}: true,`);
|
|
161
163
|
const eslintConfigContent = getEslintConfigContent(configLines.map((i) => ` ${i}`).join("\n"), []);
|
|
162
|
-
await
|
|
164
|
+
await fsPromises.writeFile(pathFlatConfig, eslintConfigContent);
|
|
163
165
|
p.log.success(c.green`Created ${configFileName}`);
|
|
164
|
-
const files = fs
|
|
166
|
+
const files = fs.readdirSync(cwd);
|
|
165
167
|
const legacyConfig = [];
|
|
166
168
|
files.forEach((file) => {
|
|
167
|
-
if (
|
|
169
|
+
if (ESLINT_OR_PRETTIER.test(file) && !ESLINT_CONFIG.test(file)) legacyConfig.push(file);
|
|
168
170
|
});
|
|
169
171
|
if (legacyConfig.length) p.note(c.dim(legacyConfig.join(", ")), "You can now remove those files manually");
|
|
170
172
|
}
|
|
@@ -174,7 +176,7 @@ async function updateEslintFiles(result) {
|
|
|
174
176
|
const versionsMap = {
|
|
175
177
|
"@eslint-react/eslint-plugin": "^2.13.0",
|
|
176
178
|
"@next/eslint-plugin-next": "^16.1.6",
|
|
177
|
-
"@unocss/eslint-plugin": "^66.6.
|
|
179
|
+
"@unocss/eslint-plugin": "^66.6.5",
|
|
178
180
|
"astro-eslint-parser": "^1.3.0",
|
|
179
181
|
"eslint": "^10.0.2",
|
|
180
182
|
"eslint-plugin-astro": "^1.6.0",
|
|
@@ -185,7 +187,7 @@ const versionsMap = {
|
|
|
185
187
|
"eslint-plugin-svelte": "^3.15.0",
|
|
186
188
|
"prettier-plugin-astro": "^0.14.1",
|
|
187
189
|
"prettier-plugin-slidev": "^1.0.5",
|
|
188
|
-
"svelte-eslint-parser": "^1.
|
|
190
|
+
"svelte-eslint-parser": "^1.6.0"
|
|
189
191
|
};
|
|
190
192
|
|
|
191
193
|
//#endregion
|
|
@@ -194,7 +196,7 @@ async function updatePackageJson(result) {
|
|
|
194
196
|
const cwd = process.cwd();
|
|
195
197
|
const pathPackageJSON = path.join(cwd, "package.json");
|
|
196
198
|
p.log.step(c.cyan`Bumping @antfu/eslint-config to v${version}`);
|
|
197
|
-
const pkgContent = await
|
|
199
|
+
const pkgContent = await fsPromises.readFile(pathPackageJSON, "utf-8");
|
|
198
200
|
const pkg = JSON.parse(pkgContent);
|
|
199
201
|
pkg.devDependencies ??= {};
|
|
200
202
|
pkg.devDependencies["@antfu/eslint-config"] = `^${version}`;
|
|
@@ -225,27 +227,28 @@ async function updatePackageJson(result) {
|
|
|
225
227
|
});
|
|
226
228
|
}
|
|
227
229
|
if (addedPackages.length) p.note(c.dim(addedPackages.join(", ")), "Added packages");
|
|
228
|
-
await
|
|
230
|
+
await fsPromises.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
|
|
229
231
|
p.log.success(c.green`Changes wrote to package.json`);
|
|
230
232
|
}
|
|
231
233
|
|
|
232
234
|
//#endregion
|
|
233
235
|
//#region src/cli/stages/update-vscode-settings.ts
|
|
236
|
+
const LAST_LINE_PATTERN = /\s*\}$/;
|
|
234
237
|
async function updateVscodeSettings(result) {
|
|
235
238
|
const cwd = process.cwd();
|
|
236
239
|
if (!result.updateVscodeSettings) return;
|
|
237
240
|
const dotVscodePath = path.join(cwd, ".vscode");
|
|
238
241
|
const settingsPath = path.join(dotVscodePath, "settings.json");
|
|
239
|
-
if (!fs
|
|
240
|
-
if (!fs
|
|
241
|
-
await
|
|
242
|
+
if (!fs.existsSync(dotVscodePath)) await fsPromises.mkdir(dotVscodePath, { recursive: true });
|
|
243
|
+
if (!fs.existsSync(settingsPath)) {
|
|
244
|
+
await fsPromises.writeFile(settingsPath, `{${vscodeSettingsString}}\n`, "utf-8");
|
|
242
245
|
p.log.success(green`Created .vscode/settings.json`);
|
|
243
246
|
} else {
|
|
244
|
-
let settingsContent = await
|
|
245
|
-
settingsContent = settingsContent.trim().replace(
|
|
247
|
+
let settingsContent = await fsPromises.readFile(settingsPath, "utf8");
|
|
248
|
+
settingsContent = settingsContent.trim().replace(LAST_LINE_PATTERN, "");
|
|
246
249
|
settingsContent += settingsContent.endsWith(",") || settingsContent.endsWith("{") ? "" : ",";
|
|
247
250
|
settingsContent += `${vscodeSettingsString}}\n`;
|
|
248
|
-
await
|
|
251
|
+
await fsPromises.writeFile(settingsPath, settingsContent, "utf-8");
|
|
249
252
|
p.log.success(green`Updated .vscode/settings.json`);
|
|
250
253
|
}
|
|
251
254
|
}
|
|
@@ -256,7 +259,7 @@ async function run(options = {}) {
|
|
|
256
259
|
const argSkipPrompt = !!process.env.SKIP_PROMPT || options.yes;
|
|
257
260
|
const argTemplate = options.frameworks?.map((m) => m?.trim()).filter(Boolean);
|
|
258
261
|
const argExtra = options.extra?.map((m) => m?.trim()).filter(Boolean);
|
|
259
|
-
if (fs
|
|
262
|
+
if (fs.existsSync(path.join(process.cwd(), "eslint.config.js"))) {
|
|
260
263
|
p.log.warn(c.yellow`eslint.config.js already exists, migration wizard exited.`);
|
|
261
264
|
return process.exit(1);
|
|
262
265
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -127,6 +127,11 @@ interface RuleOptions {
|
|
|
127
127
|
* @see https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/no-nested-tags.md
|
|
128
128
|
*/
|
|
129
129
|
'angular-template/no-nested-tags'?: Linter.RuleEntry<[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Disallows the non-null assertion operator (!) in templates
|
|
132
|
+
* @see https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/no-non-null-assertion.md
|
|
133
|
+
*/
|
|
134
|
+
'angular-template/no-non-null-assertion'?: Linter.RuleEntry<[]>;
|
|
130
135
|
/**
|
|
131
136
|
* Ensures that the `tabindex` attribute is not positive
|
|
132
137
|
* @see https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/no-positive-tabindex.md
|
|
@@ -217,6 +222,11 @@ interface RuleOptions {
|
|
|
217
222
|
* @see https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/component-selector.md
|
|
218
223
|
*/
|
|
219
224
|
'angular/component-selector'?: Linter.RuleEntry<AngularComponentSelector>;
|
|
225
|
+
/**
|
|
226
|
+
* Ensures that computed() returns a value. Omitting the value is likely a mistake.
|
|
227
|
+
* @see https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/computed-must-return.md
|
|
228
|
+
*/
|
|
229
|
+
'angular/computed-must-return'?: Linter.RuleEntry<[]>;
|
|
220
230
|
/**
|
|
221
231
|
* Ensures consistent usage of `styles`/`styleUrls`/`styleUrl` within Component metadata
|
|
222
232
|
* @see https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/consistent-component-styles.md
|
|
@@ -926,6 +936,87 @@ interface RuleOptions {
|
|
|
926
936
|
* @see https://eslint.org/docs/latest/rules/dot-notation
|
|
927
937
|
*/
|
|
928
938
|
'dot-notation'?: Linter.RuleEntry<DotNotation>;
|
|
939
|
+
/**
|
|
940
|
+
* Bans a list of dependencies from being used
|
|
941
|
+
* @see https://github.com/es-tooling/eslint-plugin-depend/blob/main/docs/rules/ban-dependencies.md
|
|
942
|
+
*/
|
|
943
|
+
'e18e/ban-dependencies'?: Linter.RuleEntry<E18EBanDependencies>;
|
|
944
|
+
/**
|
|
945
|
+
* Prefer optimized alternatives to `indexOf()` equality checks
|
|
946
|
+
*/
|
|
947
|
+
'e18e/no-indexof-equality'?: Linter.RuleEntry<[]>;
|
|
948
|
+
/**
|
|
949
|
+
* Prefer Array.prototype.at() over length-based indexing
|
|
950
|
+
*/
|
|
951
|
+
'e18e/prefer-array-at'?: Linter.RuleEntry<[]>;
|
|
952
|
+
/**
|
|
953
|
+
* Prefer Array.prototype.fill() over Array.from or map with constant values
|
|
954
|
+
*/
|
|
955
|
+
'e18e/prefer-array-fill'?: Linter.RuleEntry<[]>;
|
|
956
|
+
/**
|
|
957
|
+
* Prefer Array.from(iterable, mapper) over [...iterable].map(mapper) to avoid intermediate array allocation
|
|
958
|
+
*/
|
|
959
|
+
'e18e/prefer-array-from-map'?: Linter.RuleEntry<[]>;
|
|
960
|
+
/**
|
|
961
|
+
* Prefer Array.some() over Array.find() when checking for element existence
|
|
962
|
+
*/
|
|
963
|
+
'e18e/prefer-array-some'?: Linter.RuleEntry<[]>;
|
|
964
|
+
/**
|
|
965
|
+
* Prefer Array.prototype.toReversed() over copying and reversing arrays
|
|
966
|
+
*/
|
|
967
|
+
'e18e/prefer-array-to-reversed'?: Linter.RuleEntry<[]>;
|
|
968
|
+
/**
|
|
969
|
+
* Prefer Array.prototype.toSorted() over copying and sorting arrays
|
|
970
|
+
*/
|
|
971
|
+
'e18e/prefer-array-to-sorted'?: Linter.RuleEntry<[]>;
|
|
972
|
+
/**
|
|
973
|
+
* Prefer Array.prototype.toSpliced() over copying and splicing arrays
|
|
974
|
+
*/
|
|
975
|
+
'e18e/prefer-array-to-spliced'?: Linter.RuleEntry<[]>;
|
|
976
|
+
/**
|
|
977
|
+
* Prefer Date.now() over new Date().getTime() and +new Date()
|
|
978
|
+
*/
|
|
979
|
+
'e18e/prefer-date-now'?: Linter.RuleEntry<[]>;
|
|
980
|
+
/**
|
|
981
|
+
* Prefer the exponentiation operator ** over Math.pow()
|
|
982
|
+
*/
|
|
983
|
+
'e18e/prefer-exponentiation-operator'?: Linter.RuleEntry<[]>;
|
|
984
|
+
/**
|
|
985
|
+
* Prefer .includes() over indexOf() comparisons for arrays and strings
|
|
986
|
+
*/
|
|
987
|
+
'e18e/prefer-includes'?: Linter.RuleEntry<[]>;
|
|
988
|
+
/**
|
|
989
|
+
* Prefer inline equality checks over temporary object creation for simple comparisons
|
|
990
|
+
*/
|
|
991
|
+
'e18e/prefer-inline-equality'?: Linter.RuleEntry<[]>;
|
|
992
|
+
/**
|
|
993
|
+
* Prefer nullish coalescing operator (?? and ??=) over verbose null checks
|
|
994
|
+
*/
|
|
995
|
+
'e18e/prefer-nullish-coalescing'?: Linter.RuleEntry<[]>;
|
|
996
|
+
/**
|
|
997
|
+
* Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call() and obj.hasOwnProperty()
|
|
998
|
+
*/
|
|
999
|
+
'e18e/prefer-object-has-own'?: Linter.RuleEntry<[]>;
|
|
1000
|
+
/**
|
|
1001
|
+
* prefer `RegExp.test()` over `String.match()` and `RegExp.exec()` when only checking for match existence
|
|
1002
|
+
*/
|
|
1003
|
+
'e18e/prefer-regex-test'?: Linter.RuleEntry<[]>;
|
|
1004
|
+
/**
|
|
1005
|
+
* Prefer spread syntax over Array.concat(), Array.from(), Object.assign({}, ...), and Function.apply()
|
|
1006
|
+
*/
|
|
1007
|
+
'e18e/prefer-spread-syntax'?: Linter.RuleEntry<[]>;
|
|
1008
|
+
/**
|
|
1009
|
+
* Prefer defining regular expressions at module scope to avoid re-compilation on every function call
|
|
1010
|
+
*/
|
|
1011
|
+
'e18e/prefer-static-regex'?: Linter.RuleEntry<[]>;
|
|
1012
|
+
/**
|
|
1013
|
+
* Prefer passing function and arguments directly to setTimeout/setInterval instead of wrapping in an arrow function or using bind
|
|
1014
|
+
*/
|
|
1015
|
+
'e18e/prefer-timer-args'?: Linter.RuleEntry<[]>;
|
|
1016
|
+
/**
|
|
1017
|
+
* Prefer URL.canParse() over try-catch blocks for URL validation
|
|
1018
|
+
*/
|
|
1019
|
+
'e18e/prefer-url-canparse'?: Linter.RuleEntry<[]>;
|
|
929
1020
|
/**
|
|
930
1021
|
* Require or disallow newline at the end of files
|
|
931
1022
|
* @see https://eslint.org/docs/latest/rules/eol-last
|
|
@@ -985,6 +1076,7 @@ interface RuleOptions {
|
|
|
985
1076
|
/**
|
|
986
1077
|
* disallow unused `eslint-disable` comments
|
|
987
1078
|
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unused-disable.html
|
|
1079
|
+
* @deprecated
|
|
988
1080
|
*/
|
|
989
1081
|
'eslint-comments/no-unused-disable'?: Linter.RuleEntry<[]>;
|
|
990
1082
|
/**
|
|
@@ -9815,6 +9907,12 @@ type DotNotation = [] | [{
|
|
|
9815
9907
|
allowKeywords?: boolean;
|
|
9816
9908
|
allowPattern?: string;
|
|
9817
9909
|
}];
|
|
9910
|
+
// ----- e18e/ban-dependencies -----
|
|
9911
|
+
type E18EBanDependencies = [] | [{
|
|
9912
|
+
presets?: string[];
|
|
9913
|
+
modules?: string[];
|
|
9914
|
+
allowed?: string[];
|
|
9915
|
+
}];
|
|
9818
9916
|
// ----- eol-last -----
|
|
9819
9917
|
type EolLast = [] | [("always" | "never" | "unix" | "windows")];
|
|
9820
9918
|
// ----- eqeqeq -----
|
|
@@ -15513,33 +15611,33 @@ type StyleExpListStyle = [] | [{
|
|
|
15513
15611
|
singleLine?: _StyleExpListStyle_SingleLineConfig;
|
|
15514
15612
|
multiLine?: _StyleExpListStyle_MultiLineConfig;
|
|
15515
15613
|
overrides?: {
|
|
15516
|
-
"()"?: _StyleExpListStyle_BaseConfig;
|
|
15517
|
-
"[]"?: _StyleExpListStyle_BaseConfig;
|
|
15518
|
-
"{}"?: _StyleExpListStyle_BaseConfig;
|
|
15519
|
-
"<>"?: _StyleExpListStyle_BaseConfig;
|
|
15520
|
-
ArrayExpression?: _StyleExpListStyle_BaseConfig;
|
|
15521
|
-
ArrayPattern?: _StyleExpListStyle_BaseConfig;
|
|
15522
|
-
ArrowFunctionExpression?: _StyleExpListStyle_BaseConfig;
|
|
15523
|
-
CallExpression?: _StyleExpListStyle_BaseConfig;
|
|
15524
|
-
ExportNamedDeclaration?: _StyleExpListStyle_BaseConfig;
|
|
15525
|
-
FunctionDeclaration?: _StyleExpListStyle_BaseConfig;
|
|
15526
|
-
FunctionExpression?: _StyleExpListStyle_BaseConfig;
|
|
15527
|
-
IfStatement?: _StyleExpListStyle_BaseConfig;
|
|
15528
|
-
ImportAttributes?: _StyleExpListStyle_BaseConfig;
|
|
15529
|
-
ImportDeclaration?: _StyleExpListStyle_BaseConfig;
|
|
15530
|
-
JSONArrayExpression?: _StyleExpListStyle_BaseConfig;
|
|
15531
|
-
JSONObjectExpression?: _StyleExpListStyle_BaseConfig;
|
|
15532
|
-
NewExpression?: _StyleExpListStyle_BaseConfig;
|
|
15533
|
-
ObjectExpression?: _StyleExpListStyle_BaseConfig;
|
|
15534
|
-
ObjectPattern?: _StyleExpListStyle_BaseConfig;
|
|
15535
|
-
TSDeclareFunction?: _StyleExpListStyle_BaseConfig;
|
|
15536
|
-
TSEnumBody?: _StyleExpListStyle_BaseConfig;
|
|
15537
|
-
TSFunctionType?: _StyleExpListStyle_BaseConfig;
|
|
15538
|
-
TSInterfaceBody?: _StyleExpListStyle_BaseConfig;
|
|
15539
|
-
TSTupleType?: _StyleExpListStyle_BaseConfig;
|
|
15540
|
-
TSTypeLiteral?: _StyleExpListStyle_BaseConfig;
|
|
15541
|
-
TSTypeParameterDeclaration?: _StyleExpListStyle_BaseConfig;
|
|
15542
|
-
TSTypeParameterInstantiation?: _StyleExpListStyle_BaseConfig;
|
|
15614
|
+
"()"?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15615
|
+
"[]"?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15616
|
+
"{}"?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15617
|
+
"<>"?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15618
|
+
ArrayExpression?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15619
|
+
ArrayPattern?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15620
|
+
ArrowFunctionExpression?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15621
|
+
CallExpression?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15622
|
+
ExportNamedDeclaration?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15623
|
+
FunctionDeclaration?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15624
|
+
FunctionExpression?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15625
|
+
IfStatement?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15626
|
+
ImportAttributes?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15627
|
+
ImportDeclaration?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15628
|
+
JSONArrayExpression?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15629
|
+
JSONObjectExpression?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15630
|
+
NewExpression?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15631
|
+
ObjectExpression?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15632
|
+
ObjectPattern?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15633
|
+
TSDeclareFunction?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15634
|
+
TSEnumBody?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15635
|
+
TSFunctionType?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15636
|
+
TSInterfaceBody?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15637
|
+
TSTupleType?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15638
|
+
TSTypeLiteral?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15639
|
+
TSTypeParameterDeclaration?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15640
|
+
TSTypeParameterInstantiation?: (_StyleExpListStyle_BaseConfig | "off");
|
|
15543
15641
|
};
|
|
15544
15642
|
}];
|
|
15545
15643
|
interface _StyleExpListStyle_SingleLineConfig {
|
|
@@ -16465,6 +16563,7 @@ type StylePaddingLineBetweenStatements = {
|
|
|
16465
16563
|
}[];
|
|
16466
16564
|
interface _StylePaddingLineBetweenStatements_SelectorOption {
|
|
16467
16565
|
selector: string;
|
|
16566
|
+
lineMode?: ("any" | "singleline" | "multiline");
|
|
16468
16567
|
}
|
|
16469
16568
|
// ----- style/quote-props -----
|
|
16470
16569
|
type StyleQuoteProps = ([] | [("always" | "as-needed" | "consistent" | "consistent-as-needed")] | [] | [("always" | "as-needed" | "consistent" | "consistent-as-needed")] | [("always" | "as-needed" | "consistent" | "consistent-as-needed"), {
|
|
@@ -19773,7 +19872,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
|
|
|
19773
19872
|
onlyEquality?: boolean;
|
|
19774
19873
|
}];
|
|
19775
19874
|
// Names of all the configs
|
|
19776
|
-
type ConfigNames = 'antfu/gitignore' | 'antfu/ignores' | 'antfu/javascript/setup' | 'antfu/javascript/rules' | 'antfu/eslint-comments/rules' | 'antfu/command/rules' | 'antfu/perfectionist/setup' | 'antfu/node/setup' | 'antfu/node/rules' | 'antfu/jsdoc/setup' | 'antfu/jsdoc/rules' | 'antfu/imports/rules' | 'antfu/unicorn/rules' | 'antfu/jsx/setup' | 'antfu/typescript/setup' | 'antfu/typescript/parser' | 'antfu/typescript/type-aware-parser' | 'antfu/typescript/rules' | 'antfu/typescript/rules-type-aware' | 'antfu/typescript/erasable-syntax-only' | 'antfu/stylistic/rules' | 'antfu/regexp/rules' | 'antfu/test/setup' | 'antfu/test/rules' | 'antfu/vue/setup' | 'antfu/vue/rules' | 'antfu/react/setup' | 'antfu/react/rules' | 'antfu/react/typescript' | 'antfu/react/type-aware-rules' | 'antfu/nextjs/setup' | 'antfu/nextjs/rules' | 'antfu/solid/setup' | 'antfu/solid/rules' | 'antfu/svelte/setup' | 'antfu/svelte/rules' | 'antfu/unocss' | 'antfu/astro/setup' | 'antfu/astro/rules' | 'antfu/angular/setup' | 'antfu/angular/rules/ts' | 'antfu/angular/rules/template' | 'antfu/jsonc/setup' | 'antfu/jsonc/rules' | 'antfu/sort/package-json' | 'antfu/sort/tsconfig-json' | 'antfu/pnpm/package-json' | 'antfu/pnpm/pnpm-workspace-yaml' | 'antfu/pnpm/pnpm-workspace-yaml-sort' | 'antfu/yaml/setup' | 'antfu/yaml/rules' | 'antfu/toml/setup' | 'antfu/toml/rules' | 'antfu/markdown/setup' | 'antfu/markdown/processor' | 'antfu/markdown/parser' | 'antfu/markdown/rules' | 'antfu/markdown/disables/markdown' | 'antfu/markdown/disables/code' | 'antfu/formatter/setup' | 'antfu/formatter/css' | 'antfu/formatter/scss' | 'antfu/formatter/less' | 'antfu/formatter/html' | 'antfu/formatter/xml' | 'antfu/formatter/svg' | 'antfu/formatter/markdown' | 'antfu/formatter/astro' | 'antfu/formatter/astro/disables' | 'antfu/formatter/graphql' | 'antfu/disables/scripts' | 'antfu/disables/cli' | 'antfu/disables/bin' | 'antfu/disables/dts' | 'antfu/disables/cjs' | 'antfu/disables/config-files';
|
|
19875
|
+
type ConfigNames = 'antfu/gitignore' | 'antfu/ignores' | 'antfu/javascript/setup' | 'antfu/javascript/rules' | 'antfu/eslint-comments/rules' | 'antfu/command/rules' | 'antfu/perfectionist/setup' | 'antfu/node/setup' | 'antfu/node/rules' | 'antfu/jsdoc/setup' | 'antfu/jsdoc/rules' | 'antfu/imports/rules' | 'antfu/e18e/rules' | 'antfu/unicorn/rules' | 'antfu/jsx/setup' | 'antfu/typescript/setup' | 'antfu/typescript/parser' | 'antfu/typescript/type-aware-parser' | 'antfu/typescript/rules' | 'antfu/typescript/rules-type-aware' | 'antfu/typescript/erasable-syntax-only' | 'antfu/stylistic/rules' | 'antfu/regexp/rules' | 'antfu/test/setup' | 'antfu/test/rules' | 'antfu/vue/setup' | 'antfu/vue/rules' | 'antfu/react/setup' | 'antfu/react/rules' | 'antfu/react/typescript' | 'antfu/react/type-aware-rules' | 'antfu/nextjs/setup' | 'antfu/nextjs/rules' | 'antfu/solid/setup' | 'antfu/solid/rules' | 'antfu/svelte/setup' | 'antfu/svelte/rules' | 'antfu/unocss' | 'antfu/astro/setup' | 'antfu/astro/rules' | 'antfu/angular/setup' | 'antfu/angular/rules/ts' | 'antfu/angular/rules/template' | 'antfu/jsonc/setup' | 'antfu/jsonc/rules' | 'antfu/sort/package-json' | 'antfu/sort/tsconfig-json' | 'antfu/pnpm/package-json' | 'antfu/pnpm/pnpm-workspace-yaml' | 'antfu/pnpm/pnpm-workspace-yaml-sort' | 'antfu/yaml/setup' | 'antfu/yaml/rules' | 'antfu/toml/setup' | 'antfu/toml/rules' | 'antfu/markdown/setup' | 'antfu/markdown/processor' | 'antfu/markdown/parser' | 'antfu/markdown/rules' | 'antfu/markdown/disables/markdown' | 'antfu/markdown/disables/code' | 'antfu/formatter/setup' | 'antfu/formatter/css' | 'antfu/formatter/scss' | 'antfu/formatter/less' | 'antfu/formatter/html' | 'antfu/formatter/xml' | 'antfu/formatter/svg' | 'antfu/formatter/markdown' | 'antfu/formatter/astro' | 'antfu/formatter/astro/disables' | 'antfu/formatter/graphql' | 'antfu/disables/scripts' | 'antfu/disables/cli' | 'antfu/disables/bin' | 'antfu/disables/dts' | 'antfu/disables/cjs' | 'antfu/disables/config-files';
|
|
19777
19876
|
//#endregion
|
|
19778
19877
|
//#region src/vender/prettier-types.d.ts
|
|
19779
19878
|
/**
|
|
@@ -20032,6 +20131,29 @@ interface OptionsComponentExts {
|
|
|
20032
20131
|
*/
|
|
20033
20132
|
componentExts?: string[];
|
|
20034
20133
|
}
|
|
20134
|
+
interface OptionsE18e extends OptionsOverrides {
|
|
20135
|
+
/**
|
|
20136
|
+
* Include modernization rules
|
|
20137
|
+
*
|
|
20138
|
+
* @see https://github.com/e18e/eslint-plugin#modernization
|
|
20139
|
+
* @default true
|
|
20140
|
+
*/
|
|
20141
|
+
modernization?: boolean;
|
|
20142
|
+
/**
|
|
20143
|
+
* Include module replacements rules
|
|
20144
|
+
*
|
|
20145
|
+
* @see https://github.com/e18e/eslint-plugin#module-replacements
|
|
20146
|
+
* @default options.isInEditor
|
|
20147
|
+
*/
|
|
20148
|
+
moduleReplacements?: boolean;
|
|
20149
|
+
/**
|
|
20150
|
+
* Include performance improvements rules
|
|
20151
|
+
*
|
|
20152
|
+
* @see https://github.com/e18e/eslint-plugin#performance-improvements
|
|
20153
|
+
* @default true
|
|
20154
|
+
*/
|
|
20155
|
+
performanceImprovements?: boolean;
|
|
20156
|
+
}
|
|
20035
20157
|
interface OptionsUnicorn extends OptionsOverrides {
|
|
20036
20158
|
/**
|
|
20037
20159
|
* Include all rules recommended by `eslint-plugin-unicorn`, instead of only ones picked by Anthony.
|
|
@@ -20217,6 +20339,12 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
|
20217
20339
|
* @default true
|
|
20218
20340
|
*/
|
|
20219
20341
|
jsx?: boolean | OptionsJSX;
|
|
20342
|
+
/**
|
|
20343
|
+
* Options for [@e18e/eslint-plugin](https://github.com/e18e/eslint-plugin)
|
|
20344
|
+
*
|
|
20345
|
+
* @default true
|
|
20346
|
+
*/
|
|
20347
|
+
e18e?: boolean | OptionsE18e;
|
|
20220
20348
|
/**
|
|
20221
20349
|
* Options for eslint-plugin-unicorn.
|
|
20222
20350
|
*
|
|
@@ -20652,4 +20780,4 @@ declare function ensurePackages(packages: (string | undefined)[]): Promise<void>
|
|
|
20652
20780
|
declare function isInEditorEnv(): boolean;
|
|
20653
20781
|
declare function isInGitHooksOrLintStaged(): boolean;
|
|
20654
20782
|
//#endregion
|
|
20655
|
-
export { Awaitable, CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, type ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsJSX, OptionsJSXA11y, OptionsMarkdown, OptionsOverrides, OptionsPnpm, OptionsProjectType, OptionsReact, OptionsRegExp, OptionsStylistic, OptionsTypeScriptErasableOnly, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, OptionsVue, ResolvedOptions, type RuleOptions, Rules, StylisticConfig, StylisticConfigDefaults, StylisticOptions, TypedFlatConfigItem, angular, antfu, antfu as default, astro, combine, command, comments, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
|
20783
|
+
export { Awaitable, CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, type ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsE18e, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsJSX, OptionsJSXA11y, OptionsMarkdown, OptionsOverrides, OptionsPnpm, OptionsProjectType, OptionsReact, OptionsRegExp, OptionsStylistic, OptionsTypeScriptErasableOnly, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, OptionsVue, ResolvedOptions, type RuleOptions, Rules, StylisticConfig, StylisticConfigDefaults, StylisticOptions, TypedFlatConfigItem, angular, antfu, antfu as default, astro, combine, command, comments, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
import
|
|
3
|
+
import fsPromises from "node:fs/promises";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import fs
|
|
5
|
+
import fs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { isPackageExists } from "local-pkg";
|
|
8
8
|
import createCommand from "eslint-plugin-command/config";
|
|
9
|
+
import pluginE18e from "@e18e/eslint-plugin";
|
|
9
10
|
import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
|
|
10
11
|
import pluginAntfu from "eslint-plugin-antfu";
|
|
11
12
|
import pluginImportLite from "eslint-plugin-import-lite";
|
|
@@ -27,7 +28,7 @@ async function findUp(name, { cwd = process.cwd(), type = "file", stopAt } = {})
|
|
|
27
28
|
while (directory) {
|
|
28
29
|
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
29
30
|
try {
|
|
30
|
-
const stats = await
|
|
31
|
+
const stats = await fsPromises.stat(filePath);
|
|
31
32
|
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
|
|
32
33
|
} catch {}
|
|
33
34
|
if (directory === stopAt || directory === root) break;
|
|
@@ -42,7 +43,7 @@ function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
|
42
43
|
while (directory) {
|
|
43
44
|
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
44
45
|
try {
|
|
45
|
-
const stats = fs
|
|
46
|
+
const stats = fs.statSync(filePath, { throwIfNoEntry: false });
|
|
46
47
|
if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
|
|
47
48
|
} catch {}
|
|
48
49
|
if (directory === stopAt || directory === root) break;
|
|
@@ -229,7 +230,7 @@ async function ensurePackages(packages) {
|
|
|
229
230
|
function isInEditorEnv() {
|
|
230
231
|
if (process.env.CI) return false;
|
|
231
232
|
if (isInGitHooksOrLintStaged()) return false;
|
|
232
|
-
return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
|
|
233
|
+
return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM || process.env.ZED_ENVIRONMENT);
|
|
233
234
|
}
|
|
234
235
|
function isInGitHooksOrLintStaged() {
|
|
235
236
|
return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
|
|
@@ -528,11 +529,12 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
528
529
|
xmlSortAttributesByKey: false,
|
|
529
530
|
xmlWhitespaceSensitivity: "ignore"
|
|
530
531
|
};
|
|
531
|
-
const dprintOptions =
|
|
532
|
+
const dprintOptions = {
|
|
532
533
|
indentWidth: typeof indent === "number" ? indent : 2,
|
|
533
534
|
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
534
|
-
useTabs: indent === "tab"
|
|
535
|
-
|
|
535
|
+
useTabs: indent === "tab",
|
|
536
|
+
...options.dprintOptions || {}
|
|
537
|
+
};
|
|
536
538
|
const configs$1 = [{
|
|
537
539
|
name: "antfu/formatter/setup",
|
|
538
540
|
plugins: { format: await interopDefault(import("eslint-plugin-format")) }
|
|
@@ -1071,6 +1073,7 @@ async function markdown(options = {}) {
|
|
|
1071
1073
|
name: "antfu/markdown/rules",
|
|
1072
1074
|
rules: {
|
|
1073
1075
|
...markdown$1.configs.recommended.at(0)?.rules,
|
|
1076
|
+
"markdown/fenced-code-language": "off",
|
|
1074
1077
|
"markdown/no-missing-label-refs": "off",
|
|
1075
1078
|
...overridesMarkdown
|
|
1076
1079
|
}
|
|
@@ -1240,7 +1243,7 @@ async function perfectionist() {
|
|
|
1240
1243
|
async function detectCatalogUsage() {
|
|
1241
1244
|
const workspaceFile = await findUp("pnpm-workspace.yaml");
|
|
1242
1245
|
if (!workspaceFile) return false;
|
|
1243
|
-
const yaml$1 = await
|
|
1246
|
+
const yaml$1 = await fsPromises.readFile(workspaceFile, "utf-8");
|
|
1244
1247
|
return yaml$1.includes("catalog:") || yaml$1.includes("catalogs:");
|
|
1245
1248
|
}
|
|
1246
1249
|
async function pnpm(options) {
|
|
@@ -2452,6 +2455,23 @@ async function yaml(options = {}) {
|
|
|
2452
2455
|
}];
|
|
2453
2456
|
}
|
|
2454
2457
|
|
|
2458
|
+
//#endregion
|
|
2459
|
+
//#region src/configs/e18e.ts
|
|
2460
|
+
async function e18e(options = {}) {
|
|
2461
|
+
const { isInEditor = false, modernization = true, moduleReplacements = isInEditor, overrides = {}, performanceImprovements = true } = options;
|
|
2462
|
+
const configs$1 = pluginE18e.configs;
|
|
2463
|
+
return [{
|
|
2464
|
+
name: "antfu/e18e/rules",
|
|
2465
|
+
plugins: { e18e: pluginE18e },
|
|
2466
|
+
rules: {
|
|
2467
|
+
...modernization ? { ...configs$1.modernization.rules } : {},
|
|
2468
|
+
...moduleReplacements ? { ...configs$1.moduleReplacements.rules } : {},
|
|
2469
|
+
...performanceImprovements ? { ...configs$1.performanceImprovements.rules } : {},
|
|
2470
|
+
...overrides
|
|
2471
|
+
}
|
|
2472
|
+
}];
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2455
2475
|
//#endregion
|
|
2456
2476
|
//#region src/factory.ts
|
|
2457
2477
|
const flatConfigProps = [
|
|
@@ -2493,7 +2513,7 @@ const defaultPluginRenaming = {
|
|
|
2493
2513
|
* The merged ESLint configurations.
|
|
2494
2514
|
*/
|
|
2495
2515
|
function antfu(options = {}, ...userConfigs) {
|
|
2496
|
-
const { angular: enableAngular = false, astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, nextjs: enableNextjs = false, node: enableNode = true, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = false, regexp: enableRegexp = true, solid: enableSolid = false, svelte: enableSvelte = false, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
2516
|
+
const { angular: enableAngular = false, astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, nextjs: enableNextjs = false, node: enableNode = true, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = false, regexp: enableRegexp = true, solid: enableSolid = false, svelte: enableSvelte = false, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
2497
2517
|
let isInEditor = options.isInEditor;
|
|
2498
2518
|
if (isInEditor == null) {
|
|
2499
2519
|
isInEditor = isInEditorEnv();
|
|
@@ -2522,6 +2542,10 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2522
2542
|
stylistic: stylisticOptions,
|
|
2523
2543
|
...resolveSubOptions(options, "imports")
|
|
2524
2544
|
}));
|
|
2545
|
+
if (enableE18e) configs$1.push(e18e({
|
|
2546
|
+
isInEditor,
|
|
2547
|
+
...enableE18e === true ? {} : enableE18e
|
|
2548
|
+
}));
|
|
2525
2549
|
if (enableUnicorn) configs$1.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
|
2526
2550
|
if (enableVue) componentExts.push("vue");
|
|
2527
2551
|
if (enableJsx) configs$1.push(jsx(enableJsx === true ? {} : enableJsx));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antfu/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.7.0",
|
|
5
5
|
"description": "Anthony's ESLint config",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -113,15 +113,16 @@
|
|
|
113
113
|
},
|
|
114
114
|
"dependencies": {
|
|
115
115
|
"@antfu/install-pkg": "^1.1.0",
|
|
116
|
-
"@clack/prompts": "^1.0
|
|
117
|
-
"@
|
|
116
|
+
"@clack/prompts": "^1.1.0",
|
|
117
|
+
"@e18e/eslint-plugin": "^0.2.0",
|
|
118
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
|
|
118
119
|
"@eslint/markdown": "^7.5.1",
|
|
119
|
-
"@stylistic/eslint-plugin": "^5.
|
|
120
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
120
121
|
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
|
121
122
|
"@typescript-eslint/parser": "^8.56.1",
|
|
122
123
|
"@vitest/eslint-plugin": "^1.6.9",
|
|
123
124
|
"ansis": "^4.2.0",
|
|
124
|
-
"cac": "^
|
|
125
|
+
"cac": "^7.0.0",
|
|
125
126
|
"eslint-config-flat-gitignore": "^2.2.1",
|
|
126
127
|
"eslint-flat-config-utils": "^3.0.1",
|
|
127
128
|
"eslint-merge-processors": "^2.0.0",
|
|
@@ -129,19 +130,19 @@
|
|
|
129
130
|
"eslint-plugin-command": "^3.5.2",
|
|
130
131
|
"eslint-plugin-import-lite": "^0.5.2",
|
|
131
132
|
"eslint-plugin-jsdoc": "^62.7.1",
|
|
132
|
-
"eslint-plugin-jsonc": "^3.1.
|
|
133
|
+
"eslint-plugin-jsonc": "^3.1.1",
|
|
133
134
|
"eslint-plugin-n": "^17.24.0",
|
|
134
135
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
135
136
|
"eslint-plugin-perfectionist": "^5.6.0",
|
|
136
137
|
"eslint-plugin-pnpm": "^1.6.0",
|
|
137
138
|
"eslint-plugin-regexp": "^3.0.0",
|
|
138
|
-
"eslint-plugin-toml": "^1.3.
|
|
139
|
+
"eslint-plugin-toml": "^1.3.1",
|
|
139
140
|
"eslint-plugin-unicorn": "^63.0.0",
|
|
140
141
|
"eslint-plugin-unused-imports": "^4.4.1",
|
|
141
142
|
"eslint-plugin-vue": "^10.8.0",
|
|
142
|
-
"eslint-plugin-yml": "^3.3.
|
|
143
|
+
"eslint-plugin-yml": "^3.3.1",
|
|
143
144
|
"eslint-processor-vue-blocks": "^2.0.0",
|
|
144
|
-
"globals": "^17.
|
|
145
|
+
"globals": "^17.4.0",
|
|
145
146
|
"local-pkg": "^1.1.2",
|
|
146
147
|
"parse-gitignore": "^2.0.0",
|
|
147
148
|
"toml-eslint-parser": "^1.0.3",
|
|
@@ -149,18 +150,18 @@
|
|
|
149
150
|
"yaml-eslint-parser": "^2.0.0"
|
|
150
151
|
},
|
|
151
152
|
"devDependencies": {
|
|
152
|
-
"@angular-eslint/eslint-plugin": "^21.
|
|
153
|
-
"@angular-eslint/eslint-plugin-template": "^21.
|
|
154
|
-
"@angular-eslint/template-parser": "^21.
|
|
155
|
-
"@angular/core": "^21.1
|
|
153
|
+
"@angular-eslint/eslint-plugin": "^21.3.0",
|
|
154
|
+
"@angular-eslint/eslint-plugin-template": "^21.3.0",
|
|
155
|
+
"@angular-eslint/template-parser": "^21.3.0",
|
|
156
|
+
"@angular/core": "^21.2.1",
|
|
156
157
|
"@antfu/ni": "^28.2.0",
|
|
157
158
|
"@eslint-react/eslint-plugin": "^2.13.0",
|
|
158
|
-
"@eslint/config-inspector": "^1.
|
|
159
|
+
"@eslint/config-inspector": "^1.5.0",
|
|
159
160
|
"@next/eslint-plugin-next": "^16.1.6",
|
|
160
161
|
"@prettier/plugin-xml": "^3.4.2",
|
|
161
162
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
162
|
-
"@types/node": "^25.3.
|
|
163
|
-
"@unocss/eslint-plugin": "^66.6.
|
|
163
|
+
"@types/node": "^25.3.5",
|
|
164
|
+
"@unocss/eslint-plugin": "^66.6.5",
|
|
164
165
|
"astro-eslint-parser": "^1.3.0",
|
|
165
166
|
"baseline-browser-mapping": "^2.10.0",
|
|
166
167
|
"bumpp": "^10.4.1",
|
|
@@ -178,20 +179,20 @@
|
|
|
178
179
|
"execa": "^9.6.1",
|
|
179
180
|
"find-up-simple": "^1.0.1",
|
|
180
181
|
"jiti": "^2.6.1",
|
|
181
|
-
"lint-staged": "^16.2
|
|
182
|
+
"lint-staged": "^16.3.2",
|
|
182
183
|
"pnpm-workspace-yaml": "^1.6.0",
|
|
183
184
|
"prettier-plugin-astro": "^0.14.1",
|
|
184
185
|
"prettier-plugin-slidev": "^1.0.5",
|
|
185
186
|
"simple-git-hooks": "^2.13.1",
|
|
186
|
-
"svelte": "^5.53.
|
|
187
|
-
"svelte-eslint-parser": "^1.
|
|
187
|
+
"svelte": "^5.53.7",
|
|
188
|
+
"svelte-eslint-parser": "^1.6.0",
|
|
188
189
|
"tinyglobby": "^0.2.15",
|
|
189
190
|
"tsdown": "^0.18.4",
|
|
190
191
|
"tsx": "^4.21.0",
|
|
191
192
|
"typescript": "^5.9.3",
|
|
192
193
|
"vitest": "^4.0.18",
|
|
193
194
|
"vue": "^3.5.29",
|
|
194
|
-
"@antfu/eslint-config": "7.
|
|
195
|
+
"@antfu/eslint-config": "7.7.0"
|
|
195
196
|
},
|
|
196
197
|
"resolutions": {
|
|
197
198
|
"@eslint-community/eslint-utils": "catalog:peer",
|