@pengzhanbo/eslint-config 2.4.1 → 2.6.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.
Files changed (3) hide show
  1. package/dist/index.d.mts +543 -245
  2. package/dist/index.mjs +27 -52
  3. package/package.json +41 -41
package/dist/index.mjs CHANGED
@@ -454,6 +454,7 @@ async function e18e(options = {}) {
454
454
  //#endregion
455
455
  //#region src/configs/stylistic.ts
456
456
  const StylisticConfigDefaults = {
457
+ braceStyle: "stroustrup",
457
458
  experimental: false,
458
459
  indent: 2,
459
460
  jsx: true,
@@ -461,12 +462,13 @@ const StylisticConfigDefaults = {
461
462
  semi: false
462
463
  };
463
464
  async function stylistic(options = {}) {
464
- const { experimental, indent, jsx, overrides = {}, lessOpinionated = false, quotes, semi } = {
465
+ const { braceStyle, experimental, indent, jsx, overrides = {}, lessOpinionated = false, quotes, semi } = {
465
466
  ...StylisticConfigDefaults,
466
467
  ...options
467
468
  };
468
469
  const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
469
470
  const config = pluginStylistic.configs.customize({
471
+ braceStyle,
470
472
  experimental,
471
473
  indent,
472
474
  jsx,
@@ -1046,6 +1048,7 @@ async function markdown(options = {}) {
1046
1048
  },
1047
1049
  {
1048
1050
  files,
1051
+ ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
1049
1052
  name: "config/markdown/processor",
1050
1053
  processor: mergeProcessors([markdown.processors.markdown, processorPassThrough])
1051
1054
  },
@@ -1059,31 +1062,18 @@ async function markdown(options = {}) {
1059
1062
  name: "config/markdown/rules",
1060
1063
  rules: {
1061
1064
  ...markdown.configs.recommended.at(0)?.rules,
1065
+ "markdown/fenced-code-language": "off",
1062
1066
  "markdown/no-missing-label-refs": "off",
1063
1067
  ...overridesMarkdown
1064
1068
  }
1065
1069
  },
1066
- {
1067
- files,
1068
- name: "config/markdown/disables/markdown",
1069
- rules: {
1070
- "command/command": "off",
1071
- "no-irregular-whitespace": "off",
1072
- "perfectionist/sort-exports": "off",
1073
- "perfectionist/sort-imports": "off",
1074
- "regexp/no-legacy-features": "off",
1075
- "regexp/no-missing-g-flag": "off",
1076
- "regexp/no-useless-dollar-replacements": "off",
1077
- "regexp/no-useless-flag": "off",
1078
- "style/indent": "off"
1079
- }
1080
- },
1081
1070
  {
1082
1071
  files: [GLOB_MARKDOWN_CODE, ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)],
1083
1072
  languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
1084
1073
  name: "config/markdown/disables/code",
1085
1074
  rules: {
1086
- "antfu/no-top-level-await": "off",
1075
+ "config/no-top-level-await": "off",
1076
+ "e18e/prefer-static-regex": "off",
1087
1077
  "no-alert": "off",
1088
1078
  "no-console": "off",
1089
1079
  "no-labels": "off",
@@ -1098,10 +1088,10 @@ async function markdown(options = {}) {
1098
1088
  "style/eol-last": "off",
1099
1089
  "style/padding-line-between-statements": "off",
1100
1090
  "ts/consistent-type-imports": "off",
1091
+ "ts/explicit-function-return-type": "off",
1101
1092
  "ts/no-namespace": "off",
1102
1093
  "ts/no-redeclare": "off",
1103
1094
  "ts/no-require-imports": "off",
1104
- "ts/explicit-function-return-type": "off",
1105
1095
  "ts/no-unused-expressions": "off",
1106
1096
  "ts/no-unused-vars": "off",
1107
1097
  "ts/no-use-before-define": "off",
@@ -1173,7 +1163,8 @@ async function node() {
1173
1163
  *
1174
1164
  * @see https://github.com/azat-io/eslint-plugin-perfectionist
1175
1165
  */
1176
- async function perfectionist() {
1166
+ async function perfectionist(options) {
1167
+ const { overrides = {} } = options;
1177
1168
  return [{
1178
1169
  name: "config/perfectionist/setup",
1179
1170
  plugins: { perfectionist: pluginPerfectionist },
@@ -1222,7 +1213,8 @@ async function perfectionist() {
1222
1213
  order: "asc",
1223
1214
  type: "natural"
1224
1215
  }]
1225
- }
1216
+ },
1217
+ ...overrides
1226
1218
  }];
1227
1219
  }
1228
1220
  //#endregion
@@ -1426,11 +1418,10 @@ async function react(options = {}) {
1426
1418
  },
1427
1419
  {
1428
1420
  files: filesTypeAware,
1429
- name: "antfu/react/typescript",
1421
+ name: "config/react/typescript",
1430
1422
  rules: {
1431
- "react-dom/no-string-style-prop": "off",
1432
- "react-dom/no-unknown-property": "off",
1433
- "react/jsx-no-duplicate-props": "off"
1423
+ "react/dom-no-string-style-prop": "off",
1424
+ "react/dom-no-unknown-property": "off"
1434
1425
  }
1435
1426
  },
1436
1427
  ...isTypeAware ? [{
@@ -1775,26 +1766,10 @@ async function svelte(options = {}) {
1775
1766
  vars: "all",
1776
1767
  varsIgnorePattern: "^(\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
1777
1768
  }],
1778
- "svelte/comment-directive": "error",
1779
- "svelte/no-at-debug-tags": "warn",
1780
- "svelte/no-at-html-tags": "error",
1781
- "svelte/no-dupe-else-if-blocks": "error",
1782
- "svelte/no-dupe-style-properties": "error",
1783
- "svelte/no-dupe-use-directives": "error",
1784
- "svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
1785
- "svelte/no-inner-declarations": "error",
1786
- "svelte/no-not-function-handler": "error",
1787
- "svelte/no-object-in-text-mustaches": "error",
1788
- "svelte/no-reactive-functions": "error",
1789
- "svelte/no-reactive-literals": "error",
1790
- "svelte/no-shorthand-style-property-overrides": "error",
1791
- "svelte/no-unknown-style-directive-property": "error",
1792
- "svelte/no-unused-svelte-ignore": "error",
1793
- "svelte/no-useless-mustaches": "error",
1794
- "svelte/require-store-callbacks-use-set-param": "error",
1795
- "svelte/system": "error",
1796
- "svelte/valid-compile": "error",
1797
- "svelte/valid-each-key": "error",
1769
+ ...pluginSvelte.configs.recommended.map((config) => config.rules).reduce((acc, rules) => ({
1770
+ ...acc,
1771
+ ...rules
1772
+ }), {}),
1798
1773
  "unused-imports/no-unused-vars": ["error", {
1799
1774
  args: "after-used",
1800
1775
  argsIgnorePattern: "^_",
@@ -2131,7 +2106,7 @@ async function vue(options = {}) {
2131
2106
  ...a11y ? ["eslint-plugin-vuejs-accessibility"] : []
2132
2107
  ]);
2133
2108
  const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
2134
- const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
2109
+ const { braceStyle = "stroustrup", indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
2135
2110
  const [pluginVue, parserVue, processorVueBlocks, pluginVueA11y] = await Promise.all([
2136
2111
  interopDefault(import("eslint-plugin-vue")),
2137
2112
  interopDefault(import("vue-eslint-parser")),
@@ -2269,7 +2244,7 @@ async function vue(options = {}) {
2269
2244
  }],
2270
2245
  "vue/brace-style": [
2271
2246
  "error",
2272
- "stroustrup",
2247
+ braceStyle,
2273
2248
  { allowSingleLine: true }
2274
2249
  ],
2275
2250
  "vue/comma-dangle": ["error", "always-multiline"],
@@ -2389,10 +2364,6 @@ const VuePackages = [
2389
2364
  ];
2390
2365
  const defaultPluginRenaming = {
2391
2366
  "@eslint-react": "react",
2392
- "@eslint-react/dom": "react-dom",
2393
- "@eslint-react/naming-convention": "react-naming-convention",
2394
- "@eslint-react/rsc": "react-rsc",
2395
- "@eslint-react/web-api": "react-web-api",
2396
2367
  "@next/next": "next",
2397
2368
  "@stylistic": "style",
2398
2369
  "@typescript-eslint": "ts",
@@ -2411,7 +2382,7 @@ const defaultPluginRenaming = {
2411
2382
  * The merged ESLint configurations.
2412
2383
  */
2413
2384
  function eslintFlatConfig(options = {}, ...userConfigs) {
2414
- 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;
2385
+ 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, perfectionist: enablePerfectionist = 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;
2415
2386
  let isInEditor = options.isInEditor;
2416
2387
  if (isInEditor == null) {
2417
2388
  isInEditor = isInEditorEnv();
@@ -2433,7 +2404,8 @@ function eslintFlatConfig(options = {}, ...userConfigs) {
2433
2404
  configs.push(ignores(userIgnores, !enableTypeScript), javascript({
2434
2405
  isInEditor,
2435
2406
  overrides: getOverrides(options, "javascript")
2436
- }), comments(), node(), jsdoc({ stylistic: stylisticOptions }), imports({ stylistic: stylisticOptions }), command(), perfectionist());
2407
+ }), comments(), node(), jsdoc({ stylistic: stylisticOptions }), imports({ stylistic: stylisticOptions }), command());
2408
+ if (enablePerfectionist) configs.push(perfectionist({ overrides: getOverrides(options, "perfectionist") }));
2437
2409
  if (enableNode) configs.push(node());
2438
2410
  if (enableJsdoc) configs.push(jsdoc({ stylistic: stylisticOptions }));
2439
2411
  if (enableImports) configs.push(imports({
@@ -2534,6 +2506,7 @@ function eslintFlatConfig(options = {}, ...userConfigs) {
2534
2506
  if (Object.keys(fusedConfig).length) configs.push([fusedConfig]);
2535
2507
  let composer = new FlatConfigComposer();
2536
2508
  composer = composer.append(...configs, ...userConfigs);
2509
+ if (options.markdown ?? true) composer = composer.setDefaultIgnores((prev) => [...prev, GLOB_MARKDOWN]);
2537
2510
  if (autoRenamePlugins) composer = composer.renamePlugins(defaultPluginRenaming);
2538
2511
  if (isInEditor) composer = composer.disableRulesFix([
2539
2512
  "unused-imports/no-unused-imports",
@@ -2563,6 +2536,7 @@ const CONFIG_PRESET_FULL_ON = {
2563
2536
  markdown: true,
2564
2537
  nextjs: true,
2565
2538
  node: true,
2539
+ perfectionist: true,
2566
2540
  pnpm: true,
2567
2541
  react: true,
2568
2542
  regexp: true,
@@ -2592,6 +2566,7 @@ const CONFIG_PRESET_FULL_OFF = {
2592
2566
  markdown: false,
2593
2567
  nextjs: false,
2594
2568
  node: false,
2569
+ perfectionist: false,
2595
2570
  pnpm: false,
2596
2571
  react: false,
2597
2572
  regexp: false,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pengzhanbo/eslint-config",
3
3
  "type": "module",
4
- "version": "2.4.1",
4
+ "version": "2.6.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.3.1",
26
- "@angular-eslint/eslint-plugin-template": "^21.3.1",
27
- "@angular-eslint/template-parser": "^21.3.1",
28
- "@eslint-react/eslint-plugin": "^5.7.4",
29
- "@next/eslint-plugin-next": "^16.2.6",
25
+ "@angular-eslint/eslint-plugin": "^22.0.0",
26
+ "@angular-eslint/eslint-plugin-template": "^22.0.0",
27
+ "@angular-eslint/template-parser": "^22.0.0",
28
+ "@eslint-react/eslint-plugin": "^5.8.16",
29
+ "@next/eslint-plugin-next": "^16.2.7",
30
30
  "@prettier/plugin-xml": "^3.4.2",
31
- "@unocss/eslint-plugin": "^66.6.8",
31
+ "@unocss/eslint-plugin": "^66.7.0",
32
32
  "astro-eslint-parser": "^1.4.0",
33
- "eslint": "^10.3.0",
33
+ "eslint": "^10.4.1",
34
34
  "eslint-plugin-astro": "^1.7.0",
35
35
  "eslint-plugin-format": "^2.0.1",
36
36
  "eslint-plugin-react-refresh": "^0.5.2",
37
37
  "eslint-plugin-solid": "^0.14.5",
38
- "eslint-plugin-svelte": "^3.17.1",
38
+ "eslint-plugin-svelte": "^3.19.0",
39
39
  "eslint-plugin-tailwindcss": "^3.18.3",
40
- "eslint-plugin-vue": "^10.9.1",
40
+ "eslint-plugin-vue": "^10.9.2",
41
41
  "eslint-plugin-vuejs-accessibility": "^2.4.1",
42
42
  "eslint-processor-vue-blocks": "^2.0.0",
43
43
  "prettier-plugin-astro": "^0.14.1",
44
44
  "prettier-plugin-slidev": "^1.0.5",
45
- "svelte-eslint-parser": "^1.6.1",
46
- "vue-eslint-parser": "^10.4.0"
45
+ "svelte-eslint-parser": "^1.8.0",
46
+ "vue-eslint-parser": "^10.4.1"
47
47
  },
48
48
  "peerDependenciesMeta": {
49
49
  "@angular-eslint/eslint-plugin": {
@@ -109,66 +109,66 @@
109
109
  },
110
110
  "dependencies": {
111
111
  "@antfu/install-pkg": "^1.1.0",
112
- "@e18e/eslint-plugin": "^0.4.1",
113
- "@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
114
- "@eslint/markdown": "^8.0.1",
112
+ "@e18e/eslint-plugin": "^0.5.0",
113
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
114
+ "@eslint/markdown": "^8.0.2",
115
115
  "@stylistic/eslint-plugin": "^5.10.0",
116
- "@typescript-eslint/eslint-plugin": "^8.59.2",
117
- "@typescript-eslint/parser": "^8.59.2",
118
- "@vitest/eslint-plugin": "^1.6.17",
116
+ "@typescript-eslint/eslint-plugin": "^8.60.1",
117
+ "@typescript-eslint/parser": "^8.60.1",
118
+ "@vitest/eslint-plugin": "^1.6.19",
119
119
  "eslint-config-flat-gitignore": "^2.3.0",
120
120
  "eslint-flat-config-utils": "^3.2.0",
121
121
  "eslint-merge-processors": "^2.0.0",
122
- "eslint-plugin-antfu": "^3.2.2",
122
+ "eslint-plugin-antfu": "^3.2.3",
123
123
  "eslint-plugin-command": "^3.5.2",
124
124
  "eslint-plugin-erasable-syntax-only": "^0.4.1",
125
125
  "eslint-plugin-import-lite": "^0.6.0",
126
- "eslint-plugin-jsdoc": "^62.9.0",
127
- "eslint-plugin-jsonc": "^3.1.2",
126
+ "eslint-plugin-jsdoc": "^63.0.2",
127
+ "eslint-plugin-jsonc": "^3.2.0",
128
128
  "eslint-plugin-jsx-a11y": "^6.10.2",
129
129
  "eslint-plugin-n": "^18.0.1",
130
130
  "eslint-plugin-no-only-tests": "^3.4.0",
131
131
  "eslint-plugin-perfectionist": "^5.9.0",
132
- "eslint-plugin-pnpm": "^1.6.0",
132
+ "eslint-plugin-pnpm": "^1.6.1",
133
133
  "eslint-plugin-regexp": "^3.1.0",
134
- "eslint-plugin-toml": "^1.3.1",
135
- "eslint-plugin-unicorn": "^64.0.0",
134
+ "eslint-plugin-toml": "^1.4.0",
135
+ "eslint-plugin-unicorn": "^65.0.0",
136
136
  "eslint-plugin-unused-imports": "^4.4.1",
137
- "eslint-plugin-yml": "^3.3.2",
137
+ "eslint-plugin-yml": "^3.4.0",
138
138
  "globals": "^17.6.0",
139
- "local-pkg": "^1.1.2",
139
+ "local-pkg": "^1.2.1",
140
140
  "parse-gitignore": "^2.0.0",
141
141
  "toml-eslint-parser": "^1.0.3",
142
142
  "yaml-eslint-parser": "^2.0.0"
143
143
  },
144
144
  "devDependencies": {
145
- "@angular-eslint/eslint-plugin": "^21.3.1",
146
- "@angular-eslint/eslint-plugin-template": "^21.3.1",
147
- "@angular-eslint/template-parser": "^21.3.1",
148
- "@angular/core": "^21.2.12",
149
- "@eslint-react/eslint-plugin": "^5.7.4",
150
- "@eslint/config-inspector": "^2.0.1",
151
- "@next/eslint-plugin-next": "^16.2.6",
145
+ "@angular-eslint/eslint-plugin": "^22.0.0",
146
+ "@angular-eslint/eslint-plugin-template": "^22.0.0",
147
+ "@angular-eslint/template-parser": "^22.0.0",
148
+ "@angular/core": "^22.0.0",
149
+ "@eslint-react/eslint-plugin": "^5.8.16",
150
+ "@eslint/config-inspector": "^3.0.4",
151
+ "@next/eslint-plugin-next": "^16.2.7",
152
152
  "@prettier/plugin-xml": "^3.4.2",
153
- "@unocss/eslint-plugin": "^66.6.8",
153
+ "@unocss/eslint-plugin": "^66.7.0",
154
154
  "astro-eslint-parser": "^1.4.0",
155
- "eslint": "^10.3.0",
155
+ "eslint": "^10.4.1",
156
156
  "eslint-plugin-astro": "^1.7.0",
157
157
  "eslint-plugin-format": "^2.0.1",
158
158
  "eslint-plugin-react-refresh": "^0.5.2",
159
159
  "eslint-plugin-solid": "^0.14.5",
160
- "eslint-plugin-svelte": "^3.17.1",
160
+ "eslint-plugin-svelte": "^3.19.0",
161
161
  "eslint-plugin-tailwindcss": "^3.18.3",
162
- "eslint-plugin-vue": "^10.9.1",
162
+ "eslint-plugin-vue": "^10.9.2",
163
163
  "eslint-plugin-vuejs-accessibility": "^2.5.0",
164
164
  "eslint-processor-vue-blocks": "^2.0.0",
165
165
  "eslint-typegen": "^2.3.1",
166
166
  "find-up-simple": "^1.0.1",
167
167
  "prettier-plugin-astro": "^0.14.1",
168
168
  "prettier-plugin-slidev": "^1.0.5",
169
- "svelte": "^5.55.5",
170
- "svelte-eslint-parser": "^1.6.1",
171
- "vue-eslint-parser": "^10.4.0"
169
+ "svelte": "^5.56.3",
170
+ "svelte-eslint-parser": "^1.8.0",
171
+ "vue-eslint-parser": "^10.4.1"
172
172
  },
173
173
  "inlinedDependencies": {
174
174
  "find-up-simple": "1.0.1"
@@ -179,7 +179,7 @@
179
179
  },
180
180
  "scripts": {
181
181
  "dev": "tsdown src/index.ts --shims --format esm --watch & npx @eslint/config-inspector",
182
- "build": "pnpm typegen && tsdown src/index.ts --format esm --dts --exports --no-inline-only",
182
+ "build": "pnpm typegen && tsdown src/index.ts --format esm --dts --exports --shims",
183
183
  "build:inspector": "pnpm build && npx @eslint/config-inspector build",
184
184
  "stub": "tsdown src/index.ts --format esm",
185
185
  "typegen": "tsx scripts/typegen.ts"