@pengzhanbo/eslint-config 2.1.0 → 2.2.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/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ConfigWithExtends, FlatConfigComposer } from "eslint-flat-config-utils";
2
+ import pluginE18e from "@e18e/eslint-plugin";
2
3
  import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
3
4
  import pluginAntfu from "eslint-plugin-antfu";
4
5
  import pluginImportLite from "eslint-plugin-import-lite";
@@ -134,6 +135,11 @@ interface RuleOptions {
134
135
  * @see https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/no-nested-tags.md
135
136
  */
136
137
  'angular-template/no-nested-tags'?: Linter.RuleEntry<[]>;
138
+ /**
139
+ * Disallows the non-null assertion operator (!) in templates
140
+ * @see https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/no-non-null-assertion.md
141
+ */
142
+ 'angular-template/no-non-null-assertion'?: Linter.RuleEntry<[]>;
137
143
  /**
138
144
  * Ensures that the `tabindex` attribute is not positive
139
145
  * @see https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/no-positive-tabindex.md
@@ -224,6 +230,11 @@ interface RuleOptions {
224
230
  * @see https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/component-selector.md
225
231
  */
226
232
  'angular/component-selector'?: Linter.RuleEntry<AngularComponentSelector>;
233
+ /**
234
+ * Ensures that computed() returns a value. Omitting the value is likely a mistake.
235
+ * @see https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/computed-must-return.md
236
+ */
237
+ 'angular/computed-must-return'?: Linter.RuleEntry<[]>;
227
238
  /**
228
239
  * Ensures consistent usage of `styles`/`styleUrls`/`styleUrl` within Component metadata
229
240
  * @see https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/consistent-component-styles.md
@@ -992,6 +1003,7 @@ interface RuleOptions {
992
1003
  /**
993
1004
  * disallow unused `eslint-disable` comments
994
1005
  * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unused-disable.html
1006
+ * @deprecated
995
1007
  */
996
1008
  'eslint-comments/no-unused-disable'?: Linter.RuleEntry<[]>;
997
1009
  /**
@@ -14926,33 +14938,33 @@ type StyleExpListStyle = [] | [{
14926
14938
  singleLine?: _StyleExpListStyle_SingleLineConfig;
14927
14939
  multiLine?: _StyleExpListStyle_MultiLineConfig;
14928
14940
  overrides?: {
14929
- "()"?: _StyleExpListStyle_BaseConfig;
14930
- "[]"?: _StyleExpListStyle_BaseConfig;
14931
- "{}"?: _StyleExpListStyle_BaseConfig;
14932
- "<>"?: _StyleExpListStyle_BaseConfig;
14933
- ArrayExpression?: _StyleExpListStyle_BaseConfig;
14934
- ArrayPattern?: _StyleExpListStyle_BaseConfig;
14935
- ArrowFunctionExpression?: _StyleExpListStyle_BaseConfig;
14936
- CallExpression?: _StyleExpListStyle_BaseConfig;
14937
- ExportNamedDeclaration?: _StyleExpListStyle_BaseConfig;
14938
- FunctionDeclaration?: _StyleExpListStyle_BaseConfig;
14939
- FunctionExpression?: _StyleExpListStyle_BaseConfig;
14940
- IfStatement?: _StyleExpListStyle_BaseConfig;
14941
- ImportAttributes?: _StyleExpListStyle_BaseConfig;
14942
- ImportDeclaration?: _StyleExpListStyle_BaseConfig;
14943
- JSONArrayExpression?: _StyleExpListStyle_BaseConfig;
14944
- JSONObjectExpression?: _StyleExpListStyle_BaseConfig;
14945
- NewExpression?: _StyleExpListStyle_BaseConfig;
14946
- ObjectExpression?: _StyleExpListStyle_BaseConfig;
14947
- ObjectPattern?: _StyleExpListStyle_BaseConfig;
14948
- TSDeclareFunction?: _StyleExpListStyle_BaseConfig;
14949
- TSEnumBody?: _StyleExpListStyle_BaseConfig;
14950
- TSFunctionType?: _StyleExpListStyle_BaseConfig;
14951
- TSInterfaceBody?: _StyleExpListStyle_BaseConfig;
14952
- TSTupleType?: _StyleExpListStyle_BaseConfig;
14953
- TSTypeLiteral?: _StyleExpListStyle_BaseConfig;
14954
- TSTypeParameterDeclaration?: _StyleExpListStyle_BaseConfig;
14955
- TSTypeParameterInstantiation?: _StyleExpListStyle_BaseConfig;
14941
+ "()"?: (_StyleExpListStyle_BaseConfig | "off");
14942
+ "[]"?: (_StyleExpListStyle_BaseConfig | "off");
14943
+ "{}"?: (_StyleExpListStyle_BaseConfig | "off");
14944
+ "<>"?: (_StyleExpListStyle_BaseConfig | "off");
14945
+ ArrayExpression?: (_StyleExpListStyle_BaseConfig | "off");
14946
+ ArrayPattern?: (_StyleExpListStyle_BaseConfig | "off");
14947
+ ArrowFunctionExpression?: (_StyleExpListStyle_BaseConfig | "off");
14948
+ CallExpression?: (_StyleExpListStyle_BaseConfig | "off");
14949
+ ExportNamedDeclaration?: (_StyleExpListStyle_BaseConfig | "off");
14950
+ FunctionDeclaration?: (_StyleExpListStyle_BaseConfig | "off");
14951
+ FunctionExpression?: (_StyleExpListStyle_BaseConfig | "off");
14952
+ IfStatement?: (_StyleExpListStyle_BaseConfig | "off");
14953
+ ImportAttributes?: (_StyleExpListStyle_BaseConfig | "off");
14954
+ ImportDeclaration?: (_StyleExpListStyle_BaseConfig | "off");
14955
+ JSONArrayExpression?: (_StyleExpListStyle_BaseConfig | "off");
14956
+ JSONObjectExpression?: (_StyleExpListStyle_BaseConfig | "off");
14957
+ NewExpression?: (_StyleExpListStyle_BaseConfig | "off");
14958
+ ObjectExpression?: (_StyleExpListStyle_BaseConfig | "off");
14959
+ ObjectPattern?: (_StyleExpListStyle_BaseConfig | "off");
14960
+ TSDeclareFunction?: (_StyleExpListStyle_BaseConfig | "off");
14961
+ TSEnumBody?: (_StyleExpListStyle_BaseConfig | "off");
14962
+ TSFunctionType?: (_StyleExpListStyle_BaseConfig | "off");
14963
+ TSInterfaceBody?: (_StyleExpListStyle_BaseConfig | "off");
14964
+ TSTupleType?: (_StyleExpListStyle_BaseConfig | "off");
14965
+ TSTypeLiteral?: (_StyleExpListStyle_BaseConfig | "off");
14966
+ TSTypeParameterDeclaration?: (_StyleExpListStyle_BaseConfig | "off");
14967
+ TSTypeParameterInstantiation?: (_StyleExpListStyle_BaseConfig | "off");
14956
14968
  };
14957
14969
  }];
14958
14970
  interface _StyleExpListStyle_SingleLineConfig {
@@ -15823,6 +15835,7 @@ type StylePaddingLineBetweenStatements = {
15823
15835
  }[];
15824
15836
  interface _StylePaddingLineBetweenStatements_SelectorOption {
15825
15837
  selector: string;
15838
+ lineMode?: ("any" | "singleline" | "multiline");
15826
15839
  } // ----- style/quote-props -----
15827
15840
  type StyleQuoteProps = ([] | [("always" | "as-needed" | "consistent" | "consistent-as-needed")] | [] | [("always" | "as-needed" | "consistent" | "consistent-as-needed")] | [("always" | "as-needed" | "consistent" | "consistent-as-needed"), {
15828
15841
  keywords?: boolean;
@@ -17066,6 +17079,18 @@ type TsPreferOptionalChain = [] | [{
17066
17079
  requireNullish?: boolean;
17067
17080
  }]; // ----- ts/prefer-promise-reject-errors -----
17068
17081
  type TsPreferPromiseRejectErrors = [] | [{
17082
+ allow?: (string | {
17083
+ from: "file";
17084
+ name: (string | [string, ...(string)[]]);
17085
+ path?: string;
17086
+ } | {
17087
+ from: "lib";
17088
+ name: (string | [string, ...(string)[]]);
17089
+ } | {
17090
+ from: "package";
17091
+ name: (string | [string, ...(string)[]]);
17092
+ package: string;
17093
+ })[];
17069
17094
  allowEmptyReject?: boolean;
17070
17095
  allowThrowingAny?: boolean;
17071
17096
  allowThrowingUnknown?: boolean;
@@ -18987,6 +19012,29 @@ interface OptionsComponentExts {
18987
19012
  */
18988
19013
  componentExts?: string[];
18989
19014
  }
19015
+ interface OptionsE18e extends OptionsOverrides {
19016
+ /**
19017
+ * Include modernization rules
19018
+ *
19019
+ * @see https://github.com/e18e/eslint-plugin#modernization
19020
+ * @default true
19021
+ */
19022
+ modernization?: boolean;
19023
+ /**
19024
+ * Include module replacements rules
19025
+ *
19026
+ * @see https://github.com/e18e/eslint-plugin#module-replacements
19027
+ * @default type === 'lib' && isInEditor
19028
+ */
19029
+ moduleReplacements?: boolean;
19030
+ /**
19031
+ * Include performance improvements rules
19032
+ *
19033
+ * @see https://github.com/e18e/eslint-plugin#performance-improvements
19034
+ * @default true
19035
+ */
19036
+ performanceImprovements?: boolean;
19037
+ }
18990
19038
  interface OptionsUnicorn extends OptionsOverrides {
18991
19039
  /**
18992
19040
  * Include all rules recommended by `eslint-plugin-unicorn`, instead of only ones picked by Anthony.
@@ -19196,6 +19244,12 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
19196
19244
  */
19197
19245
  jsx?: boolean | OptionsJSX;
19198
19246
  /**
19247
+ * Options for [@e18e/eslint-plugin](https://github.com/e18e/eslint-plugin)
19248
+ *
19249
+ * @default true
19250
+ */
19251
+ e18e?: boolean | OptionsE18e;
19252
+ /**
19199
19253
  * Options for eslint-plugin-unicorn.
19200
19254
  *
19201
19255
  * @default true
@@ -19419,6 +19473,9 @@ declare function comments(): Promise<TypedFlatConfigItem[]>;
19419
19473
  //#region src/configs/disables.d.ts
19420
19474
  declare function disables(): Promise<TypedFlatConfigItem[]>;
19421
19475
  //#endregion
19476
+ //#region src/configs/e18e.d.ts
19477
+ declare function e18e(options?: OptionsE18e & OptionsProjectType & OptionsIsInEditor): Promise<TypedFlatConfigItem[]>;
19478
+ //#endregion
19422
19479
  //#region src/configs/formatters.d.ts
19423
19480
  declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<TypedFlatConfigItem[]>;
19424
19481
  //#endregion
@@ -19598,4 +19655,4 @@ declare function ensurePackages(packages: string | undefined | (string | undefin
19598
19655
  declare function isInEditorEnv(): boolean;
19599
19656
  declare function isInGitHooksOrLintStaged(): boolean;
19600
19657
  //#endregion
19601
- export { Awaitable, CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, type ConfigNames, EslintConfigOptions, EslintConfigReturn, 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, OptionsTailwindCSS, OptionsTypeScriptErasableOnly, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, OptionsVue, ResolvedOptions, type RuleOptions, Rules, StylisticConfig, StylisticConfigDefaults, StylisticOptions, TypedFlatConfigItem, UserConfig, angular, astro, combine, command, comments, eslintFlatConfig as default, eslintFlatConfig, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pluginAntfu, pluginComments, pluginImportLite, pluginNode, pluginPerfectionist, pluginUnicorn, pluginUnusedImports, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
19658
+ export { Awaitable, CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, type ConfigNames, EslintConfigOptions, EslintConfigReturn, 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, OptionsTailwindCSS, OptionsTypeScriptErasableOnly, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, OptionsVue, ResolvedOptions, type RuleOptions, Rules, StylisticConfig, StylisticConfigDefaults, StylisticOptions, TypedFlatConfigItem, UserConfig, angular, astro, combine, command, comments, eslintFlatConfig as default, eslintFlatConfig, defaultPluginRenaming, disables, e18e, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pluginAntfu, pluginComments, pluginE18e, pluginImportLite, pluginNode, pluginPerfectionist, pluginUnicorn, pluginUnusedImports, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, tailwindcss, 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 fsPromises from "node:fs/promises";
3
+ import fs from "node:fs/promises";
4
4
  import { fileURLToPath } from "node:url";
5
- import fs from "node:fs";
5
+ import fs$1 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";
@@ -16,7 +17,6 @@ import pluginUnusedImports from "eslint-plugin-unused-imports";
16
17
  import globals from "globals";
17
18
  import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
18
19
  import { configs } from "eslint-plugin-regexp";
19
-
20
20
  //#region ../../node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
21
21
  const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
22
22
  async function findUp(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
@@ -27,7 +27,7 @@ async function findUp(name, { cwd = process.cwd(), type = "file", stopAt } = {})
27
27
  while (directory) {
28
28
  const filePath = isAbsoluteName ? name : path.join(directory, name);
29
29
  try {
30
- const stats = await fsPromises.stat(filePath);
30
+ const stats = await fs.stat(filePath);
31
31
  if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
32
32
  } catch {}
33
33
  if (directory === stopAt || directory === root) break;
@@ -42,14 +42,13 @@ function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
42
42
  while (directory) {
43
43
  const filePath = isAbsoluteName ? name : path.join(directory, name);
44
44
  try {
45
- const stats = fs.statSync(filePath, { throwIfNoEntry: false });
45
+ const stats = fs$1.statSync(filePath, { throwIfNoEntry: false });
46
46
  if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
47
47
  } catch {}
48
48
  if (directory === stopAt || directory === root) break;
49
49
  directory = path.dirname(directory);
50
50
  }
51
51
  }
52
-
53
52
  //#endregion
54
53
  //#region src/globs.ts
55
54
  const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
@@ -131,7 +130,6 @@ const GLOB_EXCLUDE = [
131
130
  "**/auto-import?(s).d.ts",
132
131
  "**/components.d.ts"
133
132
  ];
134
-
135
133
  //#endregion
136
134
  //#region src/utils.ts
137
135
  const scopeUrl = fileURLToPath(new URL(".", import.meta.url));
@@ -230,12 +228,11 @@ async function ensurePackages(packages) {
230
228
  function isInEditorEnv() {
231
229
  if (process.env.CI) return false;
232
230
  if (isInGitHooksOrLintStaged()) return false;
233
- return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
231
+ return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM || process.env.ZED_ENVIRONMENT && !process.env.ZED_TERM);
234
232
  }
235
233
  function isInGitHooksOrLintStaged() {
236
234
  return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
237
235
  }
238
-
239
236
  //#endregion
240
237
  //#region src/configs/angular.ts
241
238
  async function angular(options = {}) {
@@ -301,7 +298,6 @@ async function angular(options = {}) {
301
298
  }
302
299
  ];
303
300
  }
304
-
305
301
  //#endregion
306
302
  //#region src/configs/astro.ts
307
303
  async function astro(options = {}) {
@@ -349,7 +345,6 @@ async function astro(options = {}) {
349
345
  }
350
346
  }];
351
347
  }
352
-
353
348
  //#endregion
354
349
  //#region src/configs/command.ts
355
350
  async function command() {
@@ -358,7 +353,6 @@ async function command() {
358
353
  name: "config/command/rules"
359
354
  }];
360
355
  }
361
-
362
356
  //#endregion
363
357
  //#region src/configs/comments.ts
364
358
  async function comments() {
@@ -373,7 +367,6 @@ async function comments() {
373
367
  }
374
368
  }];
375
369
  }
376
-
377
370
  //#endregion
378
371
  //#region src/configs/disables.ts
379
372
  async function disables() {
@@ -428,7 +421,22 @@ async function disables() {
428
421
  }
429
422
  ];
430
423
  }
431
-
424
+ //#endregion
425
+ //#region src/configs/e18e.ts
426
+ async function e18e(options = {}) {
427
+ const { isInEditor = false, modernization = true, type = "app", moduleReplacements = type === "lib" && isInEditor, overrides = {}, performanceImprovements = true } = options;
428
+ const configs = pluginE18e.configs;
429
+ return [{
430
+ name: "config/e18e/rules",
431
+ plugins: { e18e: pluginE18e },
432
+ rules: {
433
+ ...modernization ? { ...configs.modernization.rules } : {},
434
+ ...moduleReplacements ? { ...configs.moduleReplacements.rules } : {},
435
+ ...performanceImprovements ? { ...configs.performanceImprovements.rules } : {},
436
+ ...overrides
437
+ }
438
+ }];
439
+ }
432
440
  //#endregion
433
441
  //#region src/configs/stylistic.ts
434
442
  const StylisticConfigDefaults = {
@@ -479,7 +487,6 @@ async function stylistic(options = {}) {
479
487
  }
480
488
  }];
481
489
  }
482
-
483
490
  //#endregion
484
491
  //#region src/configs/formatters.ts
485
492
  const formatPackages = ["eslint-plugin-format"];
@@ -525,11 +532,12 @@ async function formatters(options = {}, stylistic = {}) {
525
532
  xmlSortAttributesByKey: false,
526
533
  xmlWhitespaceSensitivity: "ignore"
527
534
  };
528
- const dprintOptions = Object.assign({
535
+ const dprintOptions = {
529
536
  indentWidth: typeof indent === "number" ? indent : 2,
530
537
  quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
531
- useTabs: indent === "tab"
532
- }, options.dprintOptions || {});
538
+ useTabs: indent === "tab",
539
+ ...options.dprintOptions || {}
540
+ };
533
541
  const configs = [{
534
542
  name: "config/formatters/setup",
535
543
  plugins: { format: await interopDefault(import("eslint-plugin-format")) }
@@ -627,7 +635,6 @@ async function formatters(options = {}, stylistic = {}) {
627
635
  });
628
636
  return configs;
629
637
  }
630
-
631
638
  //#endregion
632
639
  //#region src/configs/ignores.ts
633
640
  async function ignores(userIgnores = [], ignoreTypeScript = false) {
@@ -640,7 +647,6 @@ async function ignores(userIgnores = [], ignoreTypeScript = false) {
640
647
  name: "config/ignores"
641
648
  }];
642
649
  }
643
-
644
650
  //#endregion
645
651
  //#region src/configs/imports.ts
646
652
  async function imports(_options = {}) {
@@ -654,7 +660,6 @@ async function imports(_options = {}) {
654
660
  }
655
661
  }];
656
662
  }
657
-
658
663
  //#endregion
659
664
  //#region src/configs/javascript.ts
660
665
  async function javascript(options = {}) {
@@ -879,7 +884,6 @@ async function javascript(options = {}) {
879
884
  }
880
885
  }];
881
886
  }
882
-
883
887
  //#endregion
884
888
  //#region src/configs/jsdoc.ts
885
889
  async function jsdoc(options = {}) {
@@ -913,7 +917,6 @@ async function jsdoc(options = {}) {
913
917
  }
914
918
  }];
915
919
  }
916
-
917
920
  //#endregion
918
921
  //#region src/configs/jsonc.ts
919
922
  async function jsonc(options = {}) {
@@ -979,7 +982,6 @@ async function jsonc(options = {}) {
979
982
  }
980
983
  }];
981
984
  }
982
-
983
985
  //#endregion
984
986
  //#region src/configs/jsx.ts
985
987
  async function jsx(options = {}) {
@@ -1018,7 +1020,6 @@ async function jsx(options = {}) {
1018
1020
  }
1019
1021
  }];
1020
1022
  }
1021
-
1022
1023
  //#endregion
1023
1024
  //#region src/configs/markdown.ts
1024
1025
  async function markdown(options = {}) {
@@ -1098,7 +1099,6 @@ async function markdown(options = {}) {
1098
1099
  }
1099
1100
  ];
1100
1101
  }
1101
-
1102
1102
  //#endregion
1103
1103
  //#region src/configs/nextjs.ts
1104
1104
  function normalizeRules(rules) {
@@ -1131,7 +1131,6 @@ async function nextjs(options = {}) {
1131
1131
  settings: { react: { version: "detect" } }
1132
1132
  }];
1133
1133
  }
1134
-
1135
1134
  //#endregion
1136
1135
  //#region src/configs/node.ts
1137
1136
  async function node() {
@@ -1153,7 +1152,6 @@ async function node() {
1153
1152
  }
1154
1153
  }];
1155
1154
  }
1156
-
1157
1155
  //#endregion
1158
1156
  //#region src/configs/perfectionist.ts
1159
1157
  /**
@@ -1213,13 +1211,12 @@ async function perfectionist() {
1213
1211
  }
1214
1212
  }];
1215
1213
  }
1216
-
1217
1214
  //#endregion
1218
1215
  //#region src/configs/pnpm.ts
1219
1216
  async function detectCatalogUsage() {
1220
1217
  const workspaceFile = await findUp("pnpm-workspace.yaml");
1221
1218
  if (!workspaceFile) return false;
1222
- const yaml = await fsPromises.readFile(workspaceFile, "utf-8");
1219
+ const yaml = await fs.readFile(workspaceFile, "utf-8");
1223
1220
  return yaml.includes("catalog:") || yaml.includes("catalogs:");
1224
1221
  }
1225
1222
  async function pnpm(options) {
@@ -1340,7 +1337,6 @@ async function pnpm(options) {
1340
1337
  }
1341
1338
  return configs;
1342
1339
  }
1343
-
1344
1340
  //#endregion
1345
1341
  //#region src/configs/react.ts
1346
1342
  const ReactRefreshAllowConstantExportPackages = ["vite"];
@@ -1527,7 +1523,6 @@ async function react(options = {}) {
1527
1523
  }] : []
1528
1524
  ];
1529
1525
  }
1530
-
1531
1526
  //#endregion
1532
1527
  //#region src/configs/regexp.ts
1533
1528
  async function regexp(options = {}) {
@@ -1545,7 +1540,6 @@ async function regexp(options = {}) {
1545
1540
  }
1546
1541
  }];
1547
1542
  }
1548
-
1549
1543
  //#endregion
1550
1544
  //#region src/configs/solid.ts
1551
1545
  async function solid(options = {}) {
@@ -1600,7 +1594,6 @@ async function solid(options = {}) {
1600
1594
  }
1601
1595
  }];
1602
1596
  }
1603
-
1604
1597
  //#endregion
1605
1598
  //#region src/configs/sort.ts
1606
1599
  /**
@@ -1834,7 +1827,6 @@ function sortTsconfig() {
1834
1827
  ] }
1835
1828
  }];
1836
1829
  }
1837
-
1838
1830
  //#endregion
1839
1831
  //#region src/configs/svelte.ts
1840
1832
  async function svelte(options = {}) {
@@ -1910,7 +1902,6 @@ async function svelte(options = {}) {
1910
1902
  }
1911
1903
  }];
1912
1904
  }
1913
-
1914
1905
  //#endregion
1915
1906
  //#region src/configs/tailwindcss.ts
1916
1907
  const tailwindPackages = ["eslint-plugin-tailwindcss"];
@@ -1945,7 +1936,6 @@ async function tailwindcss(options = {}) {
1945
1936
  }
1946
1937
  }];
1947
1938
  }
1948
-
1949
1939
  //#endregion
1950
1940
  //#region src/configs/test.ts
1951
1941
  let _pluginTest;
@@ -1976,6 +1966,7 @@ async function test(options = {}) {
1976
1966
  "test/prefer-hooks-in-order": "error",
1977
1967
  "test/prefer-lowercase-title": "error",
1978
1968
  "antfu/no-top-level-await": "off",
1969
+ "e18e/prefer-static-regex": "off",
1979
1970
  "no-unused-expressions": "off",
1980
1971
  "node/prefer-global/process": "off",
1981
1972
  "ts/explicit-function-return-type": "off",
@@ -1983,7 +1974,6 @@ async function test(options = {}) {
1983
1974
  }
1984
1975
  }];
1985
1976
  }
1986
-
1987
1977
  //#endregion
1988
1978
  //#region src/configs/toml.ts
1989
1979
  async function toml(options = {}) {
@@ -2024,18 +2014,17 @@ async function toml(options = {}) {
2024
2014
  }
2025
2015
  }];
2026
2016
  }
2027
-
2028
2017
  //#endregion
2029
2018
  //#region src/configs/typescript.ts
2030
2019
  async function typescript(options = {}) {
2031
2020
  const { componentExts = [], erasableOnly = false, overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options;
2032
2021
  const files = options.files ?? [
2033
- GLOB_TS,
2034
- GLOB_TSX,
2022
+ "**/*.?([cm])ts",
2023
+ "**/*.?([cm])tsx",
2035
2024
  ...componentExts.map((ext) => `**/*.${ext}`)
2036
2025
  ];
2037
- const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
2038
- const ignoresTypeAware = options.ignoresTypeAware ?? [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS];
2026
+ const filesTypeAware = options.filesTypeAware ?? ["**/*.?([cm])ts", "**/*.?([cm])tsx"];
2027
+ const ignoresTypeAware = options.ignoresTypeAware ?? [`**/*.md/**`, "**/*.astro/*.ts"];
2039
2028
  const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
2040
2029
  const isTypeAware = !!tsconfigPath;
2041
2030
  const typeAwareRules = {
@@ -2168,7 +2157,6 @@ async function typescript(options = {}) {
2168
2157
  }] : []
2169
2158
  ];
2170
2159
  }
2171
-
2172
2160
  //#endregion
2173
2161
  //#region src/configs/unicorn.ts
2174
2162
  async function unicorn(options = {}) {
@@ -2198,7 +2186,6 @@ async function unicorn(options = {}) {
2198
2186
  }
2199
2187
  }];
2200
2188
  }
2201
-
2202
2189
  //#endregion
2203
2190
  //#region src/configs/unocss.ts
2204
2191
  async function unocss(options = {}) {
@@ -2215,7 +2202,6 @@ async function unocss(options = {}) {
2215
2202
  }
2216
2203
  }];
2217
2204
  }
2218
-
2219
2205
  //#endregion
2220
2206
  //#region src/configs/vue.ts
2221
2207
  async function vue(options = {}) {
@@ -2424,7 +2410,6 @@ async function vue(options = {}) {
2424
2410
  }
2425
2411
  }];
2426
2412
  }
2427
-
2428
2413
  //#endregion
2429
2414
  //#region src/configs/yaml.ts
2430
2415
  async function yaml(options = {}) {
@@ -2467,7 +2452,6 @@ async function yaml(options = {}) {
2467
2452
  }
2468
2453
  }];
2469
2454
  }
2470
-
2471
2455
  //#endregion
2472
2456
  //#region src/factory.ts
2473
2457
  const flatConfigProps = [
@@ -2508,7 +2492,7 @@ const defaultPluginRenaming = {
2508
2492
  * The merged ESLint configurations.
2509
2493
  */
2510
2494
  function eslintFlatConfig(options = {}, ...userConfigs) {
2511
- 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, svelte: enableSvelte = false, solid: enableSolid = false, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, tailwindcss: enableTailwindcss = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
2495
+ const { angular: enableAngular = false, astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], e18e: enableE18e = false, 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, svelte: enableSvelte = false, solid: enableSolid = false, type: appType = "app", typescript: enableTypeScript = isPackageExists("typescript") || isPackageExists("@typescript/native-preview"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, tailwindcss: enableTailwindcss = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
2512
2496
  let isInEditor = options.isInEditor;
2513
2497
  if (isInEditor == null) {
2514
2498
  isInEditor = isInEditorEnv();
@@ -2537,6 +2521,10 @@ function eslintFlatConfig(options = {}, ...userConfigs) {
2537
2521
  stylistic: stylisticOptions,
2538
2522
  ...resolveSubOptions(options, "imports")
2539
2523
  }));
2524
+ if (enableE18e) configs.push(e18e({
2525
+ isInEditor,
2526
+ ...enableE18e === true ? {} : enableE18e
2527
+ }));
2540
2528
  if (enableUnicorn) configs.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
2541
2529
  if (enableVue) componentExts.push("vue");
2542
2530
  if (enableJsx) configs.push(jsx(enableJsx === true ? {} : enableJsx));
@@ -2544,7 +2532,7 @@ function eslintFlatConfig(options = {}, ...userConfigs) {
2544
2532
  ...typescriptOptions,
2545
2533
  componentExts,
2546
2534
  overrides: getOverrides(options, "typescript"),
2547
- type: options.type
2535
+ type: appType
2548
2536
  }));
2549
2537
  if (stylisticOptions) configs.push(stylistic({
2550
2538
  ...stylisticOptions,
@@ -2642,7 +2630,6 @@ function getOverrides(options, key) {
2642
2630
  const sub = resolveSubOptions(options, key);
2643
2631
  return { ..."overrides" in sub ? sub.overrides : {} };
2644
2632
  }
2645
-
2646
2633
  //#endregion
2647
2634
  //#region src/config-presets.ts
2648
2635
  const CONFIG_PRESET_FULL_ON = {
@@ -2700,10 +2687,8 @@ const CONFIG_PRESET_FULL_OFF = {
2700
2687
  vue: false,
2701
2688
  yaml: false
2702
2689
  };
2703
-
2704
2690
  //#endregion
2705
2691
  //#region src/index.ts
2706
2692
  var src_default = eslintFlatConfig;
2707
-
2708
2693
  //#endregion
2709
- export { CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, 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, StylisticConfigDefaults, angular, astro, combine, command, comments, src_default as default, defaultPluginRenaming, disables, ensurePackages, eslintFlatConfig, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pluginAntfu, pluginComments, pluginImportLite, pluginNode, pluginPerfectionist, pluginUnicorn, pluginUnusedImports, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
2694
+ export { CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, 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, StylisticConfigDefaults, angular, astro, combine, command, comments, src_default as default, defaultPluginRenaming, disables, e18e, ensurePackages, eslintFlatConfig, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pluginAntfu, pluginComments, pluginE18e, pluginImportLite, pluginNode, pluginPerfectionist, pluginUnicorn, pluginUnusedImports, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pengzhanbo/eslint-config",
3
3
  "type": "module",
4
- "version": "2.1.0",
4
+ "version": "2.2.0",
5
5
  "author": "pengzhanbo <q942450674@outlook.com> (https://github/pengzhanbo/)",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/pengzhanbo/configs#readme",
@@ -22,28 +22,28 @@
22
22
  "dist"
23
23
  ],
24
24
  "peerDependencies": {
25
- "@angular-eslint/eslint-plugin": "^21.2.0",
26
- "@angular-eslint/eslint-plugin-template": "^21.2.0",
27
- "@angular-eslint/template-parser": "^21.2.0",
25
+ "@angular-eslint/eslint-plugin": "^21.3.0",
26
+ "@angular-eslint/eslint-plugin-template": "^21.3.0",
27
+ "@angular-eslint/template-parser": "^21.3.0",
28
28
  "@eslint-react/eslint-plugin": "^2.13.0",
29
29
  "@next/eslint-plugin-next": "^16.1.6",
30
30
  "@prettier/plugin-xml": "^3.4.2",
31
- "@unocss/eslint-plugin": "^66.6.2",
31
+ "@unocss/eslint-plugin": "^66.6.6",
32
32
  "astro-eslint-parser": "^1.3.0",
33
- "eslint": "^10.0.2",
33
+ "eslint": "^10.0.3",
34
34
  "eslint-plugin-astro": "^1.6.0",
35
35
  "eslint-plugin-format": "^2.0.1",
36
36
  "eslint-plugin-react-hooks": "^7.0.1",
37
37
  "eslint-plugin-react-refresh": "^0.5.2",
38
38
  "eslint-plugin-solid": "^0.14.5",
39
- "eslint-plugin-svelte": "^3.15.0",
39
+ "eslint-plugin-svelte": "^3.15.2",
40
40
  "eslint-plugin-tailwindcss": "^3.18.2",
41
41
  "eslint-plugin-vue": "^10.8.0",
42
42
  "eslint-plugin-vuejs-accessibility": "^2.4.1",
43
43
  "eslint-processor-vue-blocks": "^2.0.0",
44
44
  "prettier-plugin-astro": "^0.14.1",
45
45
  "prettier-plugin-slidev": "^1.0.5",
46
- "svelte-eslint-parser": "^1.5.1",
46
+ "svelte-eslint-parser": "^1.6.0",
47
47
  "vue-eslint-parser": "^10.4.0"
48
48
  },
49
49
  "peerDependenciesMeta": {
@@ -113,55 +113,56 @@
113
113
  },
114
114
  "dependencies": {
115
115
  "@antfu/install-pkg": "^1.1.0",
116
- "@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
116
+ "@e18e/eslint-plugin": "^0.2.0",
117
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
117
118
  "@eslint/markdown": "^7.5.1",
118
- "@stylistic/eslint-plugin": "^5.9.0",
119
- "@typescript-eslint/eslint-plugin": "^8.56.1",
120
- "@typescript-eslint/parser": "^8.56.1",
121
- "@vitest/eslint-plugin": "^1.6.9",
119
+ "@stylistic/eslint-plugin": "^5.10.0",
120
+ "@typescript-eslint/eslint-plugin": "^8.57.0",
121
+ "@typescript-eslint/parser": "^8.57.0",
122
+ "@vitest/eslint-plugin": "^1.6.11",
122
123
  "eslint-config-flat-gitignore": "^2.2.1",
123
- "eslint-flat-config-utils": "^3.0.1",
124
+ "eslint-flat-config-utils": "^3.0.2",
124
125
  "eslint-merge-processors": "^2.0.0",
125
126
  "eslint-plugin-antfu": "^3.2.2",
126
127
  "eslint-plugin-command": "^3.5.2",
127
128
  "eslint-plugin-erasable-syntax-only": "^0.4.0",
128
129
  "eslint-plugin-import-lite": "^0.5.2",
129
- "eslint-plugin-jsdoc": "^62.7.1",
130
- "eslint-plugin-jsonc": "^3.1.1",
130
+ "eslint-plugin-jsdoc": "^62.8.0",
131
+ "eslint-plugin-jsonc": "^3.1.2",
131
132
  "eslint-plugin-jsx-a11y": "^6.10.2",
132
133
  "eslint-plugin-n": "^17.24.0",
133
134
  "eslint-plugin-no-only-tests": "^3.3.0",
134
135
  "eslint-plugin-perfectionist": "^5.6.0",
135
136
  "eslint-plugin-pnpm": "^1.6.0",
136
- "eslint-plugin-regexp": "^3.0.0",
137
- "eslint-plugin-toml": "^1.3.0",
137
+ "eslint-plugin-regexp": "^3.1.0",
138
+ "eslint-plugin-toml": "^1.3.1",
138
139
  "eslint-plugin-unicorn": "^63.0.0",
139
140
  "eslint-plugin-unused-imports": "^4.4.1",
140
- "eslint-plugin-yml": "^3.3.0",
141
- "globals": "^17.3.0",
141
+ "eslint-plugin-yml": "^3.3.1",
142
+ "globals": "^17.4.0",
142
143
  "local-pkg": "^1.1.2",
143
144
  "parse-gitignore": "^2.0.0",
144
145
  "toml-eslint-parser": "^1.0.3",
145
146
  "yaml-eslint-parser": "^2.0.0"
146
147
  },
147
148
  "devDependencies": {
148
- "@angular-eslint/eslint-plugin": "^21.2.0",
149
- "@angular-eslint/eslint-plugin-template": "^21.2.0",
150
- "@angular-eslint/template-parser": "^21.2.0",
151
- "@angular/core": "^21.2.0",
149
+ "@angular-eslint/eslint-plugin": "^21.3.0",
150
+ "@angular-eslint/eslint-plugin-template": "^21.3.0",
151
+ "@angular-eslint/template-parser": "^21.3.0",
152
+ "@angular/core": "^21.2.4",
152
153
  "@eslint-react/eslint-plugin": "^2.13.0",
153
- "@eslint/config-inspector": "^1.4.2",
154
+ "@eslint/config-inspector": "^1.5.0",
154
155
  "@next/eslint-plugin-next": "^16.1.6",
155
156
  "@prettier/plugin-xml": "^3.4.2",
156
- "@unocss/eslint-plugin": "^66.6.2",
157
+ "@unocss/eslint-plugin": "^66.6.6",
157
158
  "astro-eslint-parser": "^1.3.0",
158
- "eslint": "^10.0.2",
159
+ "eslint": "^10.0.3",
159
160
  "eslint-plugin-astro": "^1.6.0",
160
161
  "eslint-plugin-format": "^2.0.1",
161
162
  "eslint-plugin-react-hooks": "^7.0.1",
162
163
  "eslint-plugin-react-refresh": "^0.5.2",
163
164
  "eslint-plugin-solid": "^0.14.5",
164
- "eslint-plugin-svelte": "^3.15.0",
165
+ "eslint-plugin-svelte": "^3.15.2",
165
166
  "eslint-plugin-tailwindcss": "^3.18.2",
166
167
  "eslint-plugin-vue": "^10.8.0",
167
168
  "eslint-plugin-vuejs-accessibility": "^2.5.0",
@@ -170,10 +171,13 @@
170
171
  "find-up-simple": "^1.0.1",
171
172
  "prettier-plugin-astro": "^0.14.1",
172
173
  "prettier-plugin-slidev": "^1.0.5",
173
- "svelte": "^5.53.5",
174
- "svelte-eslint-parser": "^1.5.1",
174
+ "svelte": "^5.53.11",
175
+ "svelte-eslint-parser": "^1.6.0",
175
176
  "vue-eslint-parser": "^10.4.0"
176
177
  },
178
+ "inlinedDependencies": {
179
+ "find-up-simple": "1.0.1"
180
+ },
177
181
  "publishConfig": {
178
182
  "access": "public",
179
183
  "provenance": true