@pengzhanbo/eslint-config 2.4.0 → 2.5.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 +195 -136
  2. package/dist/index.mjs +24 -51
  3. package/package.json +45 -45
package/dist/index.mjs CHANGED
@@ -294,6 +294,9 @@ async function angular(options = {}) {
294
294
  "angular-template/eqeqeq": "error",
295
295
  "angular-template/no-negated-async": "error",
296
296
  "angular-template/prefer-control-flow": "error",
297
+ /**
298
+ * we need to mute some style lint rules for angular inline templates,
299
+ */
297
300
  "style/indent": "off",
298
301
  "style/no-multiple-empty-lines": ["error", { max: 1 }],
299
302
  "style/no-trailing-spaces": "off",
@@ -451,6 +454,7 @@ async function e18e(options = {}) {
451
454
  //#endregion
452
455
  //#region src/configs/stylistic.ts
453
456
  const StylisticConfigDefaults = {
457
+ braceStyle: "stroustrup",
454
458
  experimental: false,
455
459
  indent: 2,
456
460
  jsx: true,
@@ -458,12 +462,13 @@ const StylisticConfigDefaults = {
458
462
  semi: false
459
463
  };
460
464
  async function stylistic(options = {}) {
461
- const { experimental, indent, jsx, overrides = {}, lessOpinionated = false, quotes, semi } = {
465
+ const { braceStyle, experimental, indent, jsx, overrides = {}, lessOpinionated = false, quotes, semi } = {
462
466
  ...StylisticConfigDefaults,
463
467
  ...options
464
468
  };
465
469
  const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
466
470
  const config = pluginStylistic.configs.customize({
471
+ braceStyle,
467
472
  experimental,
468
473
  indent,
469
474
  jsx,
@@ -1060,21 +1065,6 @@ async function markdown(options = {}) {
1060
1065
  ...overridesMarkdown
1061
1066
  }
1062
1067
  },
1063
- {
1064
- files,
1065
- name: "config/markdown/disables/markdown",
1066
- rules: {
1067
- "command/command": "off",
1068
- "no-irregular-whitespace": "off",
1069
- "perfectionist/sort-exports": "off",
1070
- "perfectionist/sort-imports": "off",
1071
- "regexp/no-legacy-features": "off",
1072
- "regexp/no-missing-g-flag": "off",
1073
- "regexp/no-useless-dollar-replacements": "off",
1074
- "regexp/no-useless-flag": "off",
1075
- "style/indent": "off"
1076
- }
1077
- },
1078
1068
  {
1079
1069
  files: [GLOB_MARKDOWN_CODE, ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)],
1080
1070
  languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
@@ -1170,7 +1160,8 @@ async function node() {
1170
1160
  *
1171
1161
  * @see https://github.com/azat-io/eslint-plugin-perfectionist
1172
1162
  */
1173
- async function perfectionist() {
1163
+ async function perfectionist(options) {
1164
+ const { overrides = {} } = options;
1174
1165
  return [{
1175
1166
  name: "config/perfectionist/setup",
1176
1167
  plugins: { perfectionist: pluginPerfectionist },
@@ -1219,7 +1210,8 @@ async function perfectionist() {
1219
1210
  order: "asc",
1220
1211
  type: "natural"
1221
1212
  }]
1222
- }
1213
+ },
1214
+ ...overrides
1223
1215
  }];
1224
1216
  }
1225
1217
  //#endregion
@@ -1391,7 +1383,6 @@ async function react(options = {}) {
1391
1383
  name: "config/react/rules",
1392
1384
  rules: {
1393
1385
  ...pluginReact.configs.recommended.rules,
1394
- "react/prefer-namespace-import": "error",
1395
1386
  "react-refresh/only-export-components": ["error", {
1396
1387
  allowConstantExport: isAllowConstantExport,
1397
1388
  allowExportNames: [...isUsingNext ? [
@@ -1424,11 +1415,10 @@ async function react(options = {}) {
1424
1415
  },
1425
1416
  {
1426
1417
  files: filesTypeAware,
1427
- name: "antfu/react/typescript",
1418
+ name: "config/react/typescript",
1428
1419
  rules: {
1429
- "react-dom/no-string-style-prop": "off",
1430
- "react-dom/no-unknown-property": "off",
1431
- "react/jsx-no-duplicate-props": "off"
1420
+ "react/dom-no-string-style-prop": "off",
1421
+ "react/dom-no-unknown-property": "off"
1432
1422
  }
1433
1423
  },
1434
1424
  ...isTypeAware ? [{
@@ -1773,26 +1763,10 @@ async function svelte(options = {}) {
1773
1763
  vars: "all",
1774
1764
  varsIgnorePattern: "^(\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
1775
1765
  }],
1776
- "svelte/comment-directive": "error",
1777
- "svelte/no-at-debug-tags": "warn",
1778
- "svelte/no-at-html-tags": "error",
1779
- "svelte/no-dupe-else-if-blocks": "error",
1780
- "svelte/no-dupe-style-properties": "error",
1781
- "svelte/no-dupe-use-directives": "error",
1782
- "svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
1783
- "svelte/no-inner-declarations": "error",
1784
- "svelte/no-not-function-handler": "error",
1785
- "svelte/no-object-in-text-mustaches": "error",
1786
- "svelte/no-reactive-functions": "error",
1787
- "svelte/no-reactive-literals": "error",
1788
- "svelte/no-shorthand-style-property-overrides": "error",
1789
- "svelte/no-unknown-style-directive-property": "error",
1790
- "svelte/no-unused-svelte-ignore": "error",
1791
- "svelte/no-useless-mustaches": "error",
1792
- "svelte/require-store-callbacks-use-set-param": "error",
1793
- "svelte/system": "error",
1794
- "svelte/valid-compile": "error",
1795
- "svelte/valid-each-key": "error",
1766
+ ...pluginSvelte.configs.recommended.map((config) => config.rules).reduce((acc, rules) => ({
1767
+ ...acc,
1768
+ ...rules
1769
+ }), {}),
1796
1770
  "unused-imports/no-unused-vars": ["error", {
1797
1771
  args: "after-used",
1798
1772
  argsIgnorePattern: "^_",
@@ -2129,7 +2103,7 @@ async function vue(options = {}) {
2129
2103
  ...a11y ? ["eslint-plugin-vuejs-accessibility"] : []
2130
2104
  ]);
2131
2105
  const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
2132
- const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
2106
+ const { braceStyle = "stroustrup", indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
2133
2107
  const [pluginVue, parserVue, processorVueBlocks, pluginVueA11y] = await Promise.all([
2134
2108
  interopDefault(import("eslint-plugin-vue")),
2135
2109
  interopDefault(import("vue-eslint-parser")),
@@ -2267,7 +2241,7 @@ async function vue(options = {}) {
2267
2241
  }],
2268
2242
  "vue/brace-style": [
2269
2243
  "error",
2270
- "stroustrup",
2244
+ braceStyle,
2271
2245
  { allowSingleLine: true }
2272
2246
  ],
2273
2247
  "vue/comma-dangle": ["error", "always-multiline"],
@@ -2387,10 +2361,6 @@ const VuePackages = [
2387
2361
  ];
2388
2362
  const defaultPluginRenaming = {
2389
2363
  "@eslint-react": "react",
2390
- "@eslint-react/dom": "react-dom",
2391
- "@eslint-react/naming-convention": "react-naming-convention",
2392
- "@eslint-react/rsc": "react-rsc",
2393
- "@eslint-react/web-api": "react-web-api",
2394
2364
  "@next/next": "next",
2395
2365
  "@stylistic": "style",
2396
2366
  "@typescript-eslint": "ts",
@@ -2409,7 +2379,7 @@ const defaultPluginRenaming = {
2409
2379
  * The merged ESLint configurations.
2410
2380
  */
2411
2381
  function eslintFlatConfig(options = {}, ...userConfigs) {
2412
- 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;
2382
+ 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;
2413
2383
  let isInEditor = options.isInEditor;
2414
2384
  if (isInEditor == null) {
2415
2385
  isInEditor = isInEditorEnv();
@@ -2431,7 +2401,8 @@ function eslintFlatConfig(options = {}, ...userConfigs) {
2431
2401
  configs.push(ignores(userIgnores, !enableTypeScript), javascript({
2432
2402
  isInEditor,
2433
2403
  overrides: getOverrides(options, "javascript")
2434
- }), comments(), node(), jsdoc({ stylistic: stylisticOptions }), imports({ stylistic: stylisticOptions }), command(), perfectionist());
2404
+ }), comments(), node(), jsdoc({ stylistic: stylisticOptions }), imports({ stylistic: stylisticOptions }), command());
2405
+ if (enablePerfectionist) configs.push(perfectionist({ overrides: getOverrides(options, "perfectionist") }));
2435
2406
  if (enableNode) configs.push(node());
2436
2407
  if (enableJsdoc) configs.push(jsdoc({ stylistic: stylisticOptions }));
2437
2408
  if (enableImports) configs.push(imports({
@@ -2561,6 +2532,7 @@ const CONFIG_PRESET_FULL_ON = {
2561
2532
  markdown: true,
2562
2533
  nextjs: true,
2563
2534
  node: true,
2535
+ perfectionist: true,
2564
2536
  pnpm: true,
2565
2537
  react: true,
2566
2538
  regexp: true,
@@ -2590,6 +2562,7 @@ const CONFIG_PRESET_FULL_OFF = {
2590
2562
  markdown: false,
2591
2563
  nextjs: false,
2592
2564
  node: false,
2565
+ perfectionist: false,
2593
2566
  pnpm: false,
2594
2567
  react: false,
2595
2568
  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.0",
4
+ "version": "2.5.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": "^4.2.3",
29
- "@next/eslint-plugin-next": "^16.2.4",
25
+ "@angular-eslint/eslint-plugin": "^21.4.0",
26
+ "@angular-eslint/eslint-plugin-template": "^21.4.0",
27
+ "@angular-eslint/template-parser": "^21.4.0",
28
+ "@eslint-react/eslint-plugin": "^5.8.10",
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.2.1",
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.0",
38
+ "eslint-plugin-svelte": "^3.19.0",
39
39
  "eslint-plugin-tailwindcss": "^3.18.3",
40
- "eslint-plugin-vue": "^10.8.0",
40
+ "eslint-plugin-vue": "^10.9.1",
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.0",
46
- "vue-eslint-parser": "^10.4.0"
45
+ "svelte-eslint-parser": "^1.7.1",
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.3.0",
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.58.2",
117
- "@typescript-eslint/parser": "^8.58.2",
118
- "@vitest/eslint-plugin": "^1.6.16",
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
- "eslint-flat-config-utils": "^3.1.0",
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
- "eslint-plugin-erasable-syntax-only": "^0.4.0",
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.1",
127
+ "eslint-plugin-jsonc": "^3.2.0",
128
128
  "eslint-plugin-jsx-a11y": "^6.10.2",
129
- "eslint-plugin-n": "^17.24.0",
130
- "eslint-plugin-no-only-tests": "^3.3.0",
131
- "eslint-plugin-perfectionist": "^5.8.0",
132
- "eslint-plugin-pnpm": "^1.6.0",
129
+ "eslint-plugin-n": "^18.0.1",
130
+ "eslint-plugin-no-only-tests": "^3.4.0",
131
+ "eslint-plugin-perfectionist": "^5.9.0",
132
+ "eslint-plugin-pnpm": "^1.6.1",
133
133
  "eslint-plugin-regexp": "^3.1.0",
134
- "eslint-plugin-toml": "^1.3.1",
134
+ "eslint-plugin-toml": "^1.4.0",
135
135
  "eslint-plugin-unicorn": "^64.0.0",
136
136
  "eslint-plugin-unused-imports": "^4.4.1",
137
- "eslint-plugin-yml": "^3.3.1",
138
- "globals": "^17.5.0",
139
- "local-pkg": "^1.1.2",
137
+ "eslint-plugin-yml": "^3.4.0",
138
+ "globals": "^17.6.0",
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.9",
149
- "@eslint-react/eslint-plugin": "^4.2.3",
150
- "@eslint/config-inspector": "^2.0.0",
151
- "@next/eslint-plugin-next": "^16.2.4",
145
+ "@angular-eslint/eslint-plugin": "^21.4.0",
146
+ "@angular-eslint/eslint-plugin-template": "^21.4.0",
147
+ "@angular-eslint/template-parser": "^21.4.0",
148
+ "@angular/core": "^21.2.15",
149
+ "@eslint-react/eslint-plugin": "^5.8.10",
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.2.1",
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.0",
160
+ "eslint-plugin-svelte": "^3.19.0",
161
161
  "eslint-plugin-tailwindcss": "^3.18.3",
162
- "eslint-plugin-vue": "^10.8.0",
162
+ "eslint-plugin-vue": "^10.9.1",
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.4",
170
- "svelte-eslint-parser": "^1.6.0",
171
- "vue-eslint-parser": "^10.4.0"
169
+ "svelte": "^5.56.1",
170
+ "svelte-eslint-parser": "^1.7.1",
171
+ "vue-eslint-parser": "^10.4.1"
172
172
  },
173
173
  "inlinedDependencies": {
174
174
  "find-up-simple": "1.0.1"