@antfu/eslint-config 7.6.0 → 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 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
@@ -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.6.0";
12
+ var version = "7.7.0";
13
13
 
14
14
  //#endregion
15
15
  //#region src/cli/constants.ts
@@ -139,6 +139,8 @@ ${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");
@@ -164,7 +166,7 @@ async function updateEslintFiles(result) {
164
166
  const files = fs.readdirSync(cwd);
165
167
  const legacyConfig = [];
166
168
  files.forEach((file) => {
167
- if (/eslint|prettier/.test(file) && !/eslint\.config\./.test(file)) legacyConfig.push(file);
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,18 +176,18 @@ 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.0",
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",
181
- "eslint-plugin-format": "^2.0.0",
183
+ "eslint-plugin-format": "^2.0.1",
182
184
  "eslint-plugin-react-hooks": "^7.0.1",
183
185
  "eslint-plugin-react-refresh": "^0.5.2",
184
186
  "eslint-plugin-solid": "^0.14.5",
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.5.0"
190
+ "svelte-eslint-parser": "^1.6.0"
189
191
  };
190
192
 
191
193
  //#endregion
@@ -231,6 +233,7 @@ async function updatePackageJson(result) {
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;
@@ -242,7 +245,7 @@ async function updateVscodeSettings(result) {
242
245
  p.log.success(green`Created .vscode/settings.json`);
243
246
  } else {
244
247
  let settingsContent = await fsPromises.readFile(settingsPath, "utf8");
245
- settingsContent = settingsContent.trim().replace(/\s*\}$/, "");
248
+ settingsContent = settingsContent.trim().replace(LAST_LINE_PATTERN, "");
246
249
  settingsContent += settingsContent.endsWith(",") || settingsContent.endsWith("{") ? "" : ",";
247
250
  settingsContent += `${vscodeSettingsString}}\n`;
248
251
  await fsPromises.writeFile(settingsPath, settingsContent, "utf-8");
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/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
@@ -6,6 +6,7 @@ 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";
@@ -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 = Object.assign({
532
+ const dprintOptions = {
532
533
  indentWidth: typeof indent === "number" ? indent : 2,
533
534
  quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
534
- useTabs: indent === "tab"
535
- }, options.dprintOptions || {});
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
  }
@@ -1163,9 +1166,11 @@ async function nextjs(options = {}) {
1163
1166
  //#region src/configs/node.ts
1164
1167
  async function node() {
1165
1168
  return [{
1169
+ name: "antfu/node/setup",
1170
+ plugins: { node: pluginNode }
1171
+ }, {
1166
1172
  files: [GLOB_SRC],
1167
1173
  name: "antfu/node/rules",
1168
- plugins: { node: pluginNode },
1169
1174
  rules: {
1170
1175
  "node/handle-callback-err": ["error", "^(err|error)$"],
1171
1176
  "node/no-deprecated-api": "error",
@@ -2450,6 +2455,23 @@ async function yaml(options = {}) {
2450
2455
  }];
2451
2456
  }
2452
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
+
2453
2475
  //#endregion
2454
2476
  //#region src/factory.ts
2455
2477
  const flatConfigProps = [
@@ -2491,7 +2513,7 @@ const defaultPluginRenaming = {
2491
2513
  * The merged ESLint configurations.
2492
2514
  */
2493
2515
  function antfu(options = {}, ...userConfigs) {
2494
- 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;
2495
2517
  let isInEditor = options.isInEditor;
2496
2518
  if (isInEditor == null) {
2497
2519
  isInEditor = isInEditorEnv();
@@ -2520,6 +2542,10 @@ function antfu(options = {}, ...userConfigs) {
2520
2542
  stylistic: stylisticOptions,
2521
2543
  ...resolveSubOptions(options, "imports")
2522
2544
  }));
2545
+ if (enableE18e) configs$1.push(e18e({
2546
+ isInEditor,
2547
+ ...enableE18e === true ? {} : enableE18e
2548
+ }));
2523
2549
  if (enableUnicorn) configs$1.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
2524
2550
  if (enableVue) componentExts.push("vue");
2525
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.6.0",
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,35 +113,36 @@
113
113
  },
114
114
  "dependencies": {
115
115
  "@antfu/install-pkg": "^1.1.0",
116
- "@clack/prompts": "^1.0.1",
117
- "@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
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.9.0",
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": "^6.7.14",
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",
128
129
  "eslint-plugin-antfu": "^3.2.2",
129
- "eslint-plugin-command": "^3.5.1",
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.0",
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
- "eslint-plugin-pnpm": "^1.5.0",
137
+ "eslint-plugin-pnpm": "^1.6.0",
137
138
  "eslint-plugin-regexp": "^3.0.0",
138
- "eslint-plugin-toml": "^1.3.0",
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.0",
143
+ "eslint-plugin-yml": "^3.3.1",
143
144
  "eslint-processor-vue-blocks": "^2.0.0",
144
- "globals": "^17.3.0",
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,25 +150,25 @@
149
150
  "yaml-eslint-parser": "^2.0.0"
150
151
  },
151
152
  "devDependencies": {
152
- "@angular-eslint/eslint-plugin": "^21.2.0",
153
- "@angular-eslint/eslint-plugin-template": "^21.2.0",
154
- "@angular-eslint/template-parser": "^21.2.0",
155
- "@angular/core": "^21.1.5",
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.4.2",
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.0",
163
- "@unocss/eslint-plugin": "^66.6.0",
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",
167
168
  "eslint": "^10.0.2",
168
169
  "eslint-plugin-astro": "^1.6.0",
169
170
  "eslint-plugin-erasable-syntax-only": "^0.4.0",
170
- "eslint-plugin-format": "^2.0.0",
171
+ "eslint-plugin-format": "^2.0.1",
171
172
  "eslint-plugin-jsx-a11y": "^6.10.2",
172
173
  "eslint-plugin-react-hooks": "^7.0.1",
173
174
  "eslint-plugin-react-refresh": "^0.5.2",
@@ -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.7",
182
- "pnpm-workspace-yaml": "^1.5.0",
182
+ "lint-staged": "^16.3.2",
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.3",
187
- "svelte-eslint-parser": "^1.5.0",
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.6.0"
195
+ "@antfu/eslint-config": "7.7.0"
195
196
  },
196
197
  "resolutions": {
197
198
  "@eslint-community/eslint-utils": "catalog:peer",