@pengzhanbo/eslint-config 2.2.0 → 2.4.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 +880 -554
  2. package/dist/index.mjs +25 -108
  3. package/package.json +38 -43
package/dist/index.mjs CHANGED
@@ -122,13 +122,17 @@ const GLOB_EXCLUDE = [
122
122
  "**/.output",
123
123
  "**/.vite-inspect",
124
124
  "**/.yarn",
125
- "**/vite.config.*.timestamp-*",
126
125
  "**/CHANGELOG*.md",
127
- "**/*.min.*",
128
126
  "**/LICENSE*",
129
127
  "**/__snapshots__",
128
+ "**/vite.config.*.timestamp-*",
130
129
  "**/auto-import?(s).d.ts",
131
- "**/components.d.ts"
130
+ "**/components.d.ts",
131
+ "**/.context",
132
+ "**/.claude",
133
+ "**/.agents",
134
+ "**/.trae",
135
+ "**/.*/skills"
132
136
  ];
133
137
  //#endregion
134
138
  //#region src/utils.ts
@@ -433,6 +437,13 @@ async function e18e(options = {}) {
433
437
  ...modernization ? { ...configs.modernization.rules } : {},
434
438
  ...moduleReplacements ? { ...configs.moduleReplacements.rules } : {},
435
439
  ...performanceImprovements ? { ...configs.performanceImprovements.rules } : {},
440
+ ...type === "lib" ? {} : { "e18e/prefer-static-regex": "off" },
441
+ "e18e/prefer-array-at": "off",
442
+ "e18e/prefer-array-from-map": "off",
443
+ "e18e/prefer-array-to-reversed": "off",
444
+ "e18e/prefer-array-to-sorted": "off",
445
+ "e18e/prefer-array-to-spliced": "off",
446
+ "e18e/prefer-spread-syntax": "off",
436
447
  ...overrides
437
448
  }
438
449
  }];
@@ -1353,41 +1364,22 @@ const ReactRouterPackages = [
1353
1364
  "@react-router/dev"
1354
1365
  ];
1355
1366
  const NextJsPackages = ["next"];
1356
- const ReactCompilerPackages = ["babel-plugin-react-compiler"];
1357
1367
  async function react(options = {}) {
1358
- const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], overrides = {}, tsconfigPath, reactCompiler = ReactCompilerPackages.some((i) => isPackageExists(i)) } = options;
1359
- await ensurePackages([
1360
- "@eslint-react/eslint-plugin",
1361
- "eslint-plugin-react-hooks",
1362
- "eslint-plugin-react-refresh"
1363
- ]);
1368
+ const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], overrides = {}, tsconfigPath } = options;
1369
+ await ensurePackages(["@eslint-react/eslint-plugin", "eslint-plugin-react-refresh"]);
1364
1370
  const isTypeAware = !!tsconfigPath;
1365
- const typeAwareRules = {
1366
- "react/no-leaked-conditional-rendering": "warn",
1367
- "react/no-implicit-key": "error"
1368
- };
1369
- const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
1370
- interopDefault(import("@eslint-react/eslint-plugin")),
1371
- interopDefault(import("eslint-plugin-react-hooks")),
1372
- interopDefault(import("eslint-plugin-react-refresh"))
1373
- ]);
1371
+ const typeAwareRules = { "react/no-leaked-conditional-rendering": "warn" };
1372
+ const [pluginReact, pluginReactRefresh] = await Promise.all([interopDefault(import("@eslint-react/eslint-plugin")), interopDefault(import("eslint-plugin-react-refresh"))]);
1374
1373
  const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => isPackageExists(i));
1375
1374
  const isUsingRemix = RemixPackages.some((i) => isPackageExists(i));
1376
1375
  const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
1377
1376
  const isUsingNext = NextJsPackages.some((i) => isPackageExists(i));
1378
- const plugins = pluginReact.configs.all.plugins;
1379
1377
  return [
1380
1378
  {
1381
1379
  name: "config/react/setup",
1382
1380
  plugins: {
1383
- "react": plugins["@eslint-react"],
1384
- "react-dom": plugins["@eslint-react/dom"],
1385
- "react-hooks": pluginReactHooks,
1386
- "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1387
- "react-naming-convention": plugins["@eslint-react/naming-convention"],
1388
- "react-refresh": pluginReactRefresh,
1389
- "react-rsc": plugins["@eslint-react/rsc"],
1390
- "react-web-api": plugins["@eslint-react/web-api"]
1381
+ "react": pluginReact.configs.all.plugins["@eslint-react"],
1382
+ "react-refresh": pluginReactRefresh
1391
1383
  }
1392
1384
  },
1393
1385
  {
@@ -1398,81 +1390,8 @@ async function react(options = {}) {
1398
1390
  },
1399
1391
  name: "config/react/rules",
1400
1392
  rules: {
1401
- "react/jsx-no-duplicate-props": "warn",
1402
- "react/jsx-uses-vars": "warn",
1403
- "react/no-access-state-in-setstate": "error",
1404
- "react/no-array-index-key": "warn",
1405
- "react/no-children-count": "warn",
1406
- "react/no-children-for-each": "warn",
1407
- "react/no-children-map": "warn",
1408
- "react/no-children-only": "warn",
1409
- "react/no-children-to-array": "warn",
1410
- "react/no-clone-element": "warn",
1411
- "react/no-component-will-mount": "error",
1412
- "react/no-component-will-receive-props": "error",
1413
- "react/no-component-will-update": "error",
1414
- "react/no-context-provider": "warn",
1415
- "react/no-create-ref": "error",
1416
- "react/no-default-props": "error",
1417
- "react/no-direct-mutation-state": "error",
1418
- "react/no-forward-ref": "warn",
1419
- "react/no-missing-key": "error",
1420
- "react/no-nested-component-definitions": "error",
1421
- "react/no-nested-lazy-component-declarations": "error",
1422
- "react/no-prop-types": "error",
1423
- "react/no-redundant-should-component-update": "error",
1424
- "react/no-set-state-in-component-did-mount": "warn",
1425
- "react/no-set-state-in-component-did-update": "warn",
1426
- "react/no-set-state-in-component-will-update": "warn",
1427
- "react/no-unused-class-component-members": "warn",
1428
- "react/no-string-refs": "error",
1429
- "react/no-unsafe-component-will-mount": "warn",
1430
- "react/no-unsafe-component-will-receive-props": "warn",
1431
- "react/no-unsafe-component-will-update": "warn",
1432
- "react/no-use-context": "warn",
1433
- "react/no-useless-forward-ref": "warn",
1434
- "react/prefer-use-state-lazy-initialization": "warn",
1393
+ ...pluginReact.configs.recommended.rules,
1435
1394
  "react/prefer-namespace-import": "error",
1436
- "react-rsc/function-definition": "error",
1437
- "react-dom/no-dangerously-set-innerhtml": "warn",
1438
- "react-dom/no-dangerously-set-innerhtml-with-children": "error",
1439
- "react-dom/no-find-dom-node": "error",
1440
- "react-dom/no-flush-sync": "error",
1441
- "react-dom/no-hydrate": "error",
1442
- "react-dom/no-namespace": "error",
1443
- "react-dom/no-render": "error",
1444
- "react-dom/no-render-return-value": "error",
1445
- "react-dom/no-script-url": "warn",
1446
- "react-dom/no-unsafe-iframe-sandbox": "warn",
1447
- "react-dom/no-use-form-state": "error",
1448
- "react-dom/no-void-elements-with-children": "error",
1449
- "react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
1450
- "react-naming-convention/context-name": "warn",
1451
- "react-naming-convention/ref-name": "warn",
1452
- "react-naming-convention/use-state": "warn",
1453
- "react-web-api/no-leaked-event-listener": "warn",
1454
- "react-web-api/no-leaked-interval": "warn",
1455
- "react-web-api/no-leaked-resize-observer": "warn",
1456
- "react-web-api/no-leaked-timeout": "warn",
1457
- "react-hooks/rules-of-hooks": "error",
1458
- "react-hooks/exhaustive-deps": "warn",
1459
- ...reactCompiler ? {
1460
- "react-hooks/config": "error",
1461
- "react-hooks/error-boundaries": "error",
1462
- "react-hooks/component-hook-factories": "error",
1463
- "react-hooks/gating": "error",
1464
- "react-hooks/globals": "error",
1465
- "react-hooks/immutability": "error",
1466
- "react-hooks/preserve-manual-memoization": "error",
1467
- "react-hooks/purity": "error",
1468
- "react-hooks/refs": "error",
1469
- "react-hooks/set-state-in-effect": "error",
1470
- "react-hooks/set-state-in-render": "error",
1471
- "react-hooks/static-components": "error",
1472
- "react-hooks/unsupported-syntax": "warn",
1473
- "react-hooks/use-memo": "error",
1474
- "react-hooks/incompatible-library": "warn"
1475
- } : {},
1476
1395
  "react-refresh/only-export-components": ["error", {
1477
1396
  allowConstantExport: isAllowConstantExport,
1478
1397
  allowExportNames: [...isUsingNext ? [
@@ -1509,10 +1428,7 @@ async function react(options = {}) {
1509
1428
  rules: {
1510
1429
  "react-dom/no-string-style-prop": "off",
1511
1430
  "react-dom/no-unknown-property": "off",
1512
- "react/jsx-no-duplicate-props": "off",
1513
- "react/jsx-no-undef": "off",
1514
- "react/jsx-uses-react": "off",
1515
- "react/jsx-uses-vars": "off"
1431
+ "react/jsx-no-duplicate-props": "off"
1516
1432
  }
1517
1433
  },
1518
1434
  ...isTypeAware ? [{
@@ -2472,8 +2388,9 @@ const VuePackages = [
2472
2388
  const defaultPluginRenaming = {
2473
2389
  "@eslint-react": "react",
2474
2390
  "@eslint-react/dom": "react-dom",
2475
- "@eslint-react/hooks-extra": "react-hooks-extra",
2476
2391
  "@eslint-react/naming-convention": "react-naming-convention",
2392
+ "@eslint-react/rsc": "react-rsc",
2393
+ "@eslint-react/web-api": "react-web-api",
2477
2394
  "@next/next": "next",
2478
2395
  "@stylistic": "style",
2479
2396
  "@typescript-eslint": "ts",
@@ -2645,7 +2562,7 @@ const CONFIG_PRESET_FULL_ON = {
2645
2562
  nextjs: true,
2646
2563
  node: true,
2647
2564
  pnpm: true,
2648
- react: { reactCompiler: true },
2565
+ react: true,
2649
2566
  regexp: true,
2650
2567
  solid: true,
2651
2568
  stylistic: { experimental: true },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pengzhanbo/eslint-config",
3
3
  "type": "module",
4
- "version": "2.2.0",
4
+ "version": "2.4.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,22 +22,21 @@
22
22
  "dist"
23
23
  ],
24
24
  "peerDependencies": {
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
- "@eslint-react/eslint-plugin": "^2.13.0",
29
- "@next/eslint-plugin-next": "^16.1.6",
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",
30
30
  "@prettier/plugin-xml": "^3.4.2",
31
- "@unocss/eslint-plugin": "^66.6.6",
32
- "astro-eslint-parser": "^1.3.0",
33
- "eslint": "^10.0.3",
34
- "eslint-plugin-astro": "^1.6.0",
31
+ "@unocss/eslint-plugin": "^66.6.8",
32
+ "astro-eslint-parser": "^1.4.0",
33
+ "eslint": "^10.2.1",
34
+ "eslint-plugin-astro": "^1.7.0",
35
35
  "eslint-plugin-format": "^2.0.1",
36
- "eslint-plugin-react-hooks": "^7.0.1",
37
36
  "eslint-plugin-react-refresh": "^0.5.2",
38
37
  "eslint-plugin-solid": "^0.14.5",
39
- "eslint-plugin-svelte": "^3.15.2",
40
- "eslint-plugin-tailwindcss": "^3.18.2",
38
+ "eslint-plugin-svelte": "^3.17.0",
39
+ "eslint-plugin-tailwindcss": "^3.18.3",
41
40
  "eslint-plugin-vue": "^10.8.0",
42
41
  "eslint-plugin-vuejs-accessibility": "^2.4.1",
43
42
  "eslint-processor-vue-blocks": "^2.0.0",
@@ -77,9 +76,6 @@
77
76
  "eslint-plugin-format": {
78
77
  "optional": true
79
78
  },
80
- "eslint-plugin-react-hooks": {
81
- "optional": true
82
- },
83
79
  "eslint-plugin-react-refresh": {
84
80
  "optional": true
85
81
  },
@@ -113,57 +109,56 @@
113
109
  },
114
110
  "dependencies": {
115
111
  "@antfu/install-pkg": "^1.1.0",
116
- "@e18e/eslint-plugin": "^0.2.0",
112
+ "@e18e/eslint-plugin": "^0.3.0",
117
113
  "@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
118
- "@eslint/markdown": "^7.5.1",
114
+ "@eslint/markdown": "^8.0.1",
119
115
  "@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",
123
- "eslint-config-flat-gitignore": "^2.2.1",
124
- "eslint-flat-config-utils": "^3.0.2",
116
+ "@typescript-eslint/eslint-plugin": "^8.58.2",
117
+ "@typescript-eslint/parser": "^8.58.2",
118
+ "@vitest/eslint-plugin": "^1.6.16",
119
+ "eslint-config-flat-gitignore": "^2.3.0",
120
+ "eslint-flat-config-utils": "^3.1.0",
125
121
  "eslint-merge-processors": "^2.0.0",
126
122
  "eslint-plugin-antfu": "^3.2.2",
127
123
  "eslint-plugin-command": "^3.5.2",
128
124
  "eslint-plugin-erasable-syntax-only": "^0.4.0",
129
- "eslint-plugin-import-lite": "^0.5.2",
130
- "eslint-plugin-jsdoc": "^62.8.0",
125
+ "eslint-plugin-import-lite": "^0.6.0",
126
+ "eslint-plugin-jsdoc": "^62.9.0",
131
127
  "eslint-plugin-jsonc": "^3.1.2",
132
128
  "eslint-plugin-jsx-a11y": "^6.10.2",
133
129
  "eslint-plugin-n": "^17.24.0",
134
130
  "eslint-plugin-no-only-tests": "^3.3.0",
135
- "eslint-plugin-perfectionist": "^5.6.0",
131
+ "eslint-plugin-perfectionist": "^5.8.0",
136
132
  "eslint-plugin-pnpm": "^1.6.0",
137
133
  "eslint-plugin-regexp": "^3.1.0",
138
134
  "eslint-plugin-toml": "^1.3.1",
139
- "eslint-plugin-unicorn": "^63.0.0",
135
+ "eslint-plugin-unicorn": "^64.0.0",
140
136
  "eslint-plugin-unused-imports": "^4.4.1",
141
137
  "eslint-plugin-yml": "^3.3.1",
142
- "globals": "^17.4.0",
138
+ "globals": "^17.5.0",
143
139
  "local-pkg": "^1.1.2",
144
140
  "parse-gitignore": "^2.0.0",
145
141
  "toml-eslint-parser": "^1.0.3",
146
142
  "yaml-eslint-parser": "^2.0.0"
147
143
  },
148
144
  "devDependencies": {
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",
153
- "@eslint-react/eslint-plugin": "^2.13.0",
154
- "@eslint/config-inspector": "^1.5.0",
155
- "@next/eslint-plugin-next": "^16.1.6",
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",
156
152
  "@prettier/plugin-xml": "^3.4.2",
157
- "@unocss/eslint-plugin": "^66.6.6",
158
- "astro-eslint-parser": "^1.3.0",
159
- "eslint": "^10.0.3",
160
- "eslint-plugin-astro": "^1.6.0",
153
+ "@unocss/eslint-plugin": "^66.6.8",
154
+ "astro-eslint-parser": "^1.4.0",
155
+ "eslint": "^10.2.1",
156
+ "eslint-plugin-astro": "^1.7.0",
161
157
  "eslint-plugin-format": "^2.0.1",
162
- "eslint-plugin-react-hooks": "^7.0.1",
163
158
  "eslint-plugin-react-refresh": "^0.5.2",
164
159
  "eslint-plugin-solid": "^0.14.5",
165
- "eslint-plugin-svelte": "^3.15.2",
166
- "eslint-plugin-tailwindcss": "^3.18.2",
160
+ "eslint-plugin-svelte": "^3.17.0",
161
+ "eslint-plugin-tailwindcss": "^3.18.3",
167
162
  "eslint-plugin-vue": "^10.8.0",
168
163
  "eslint-plugin-vuejs-accessibility": "^2.5.0",
169
164
  "eslint-processor-vue-blocks": "^2.0.0",
@@ -171,7 +166,7 @@
171
166
  "find-up-simple": "^1.0.1",
172
167
  "prettier-plugin-astro": "^0.14.1",
173
168
  "prettier-plugin-slidev": "^1.0.5",
174
- "svelte": "^5.53.11",
169
+ "svelte": "^5.55.4",
175
170
  "svelte-eslint-parser": "^1.6.0",
176
171
  "vue-eslint-parser": "^10.4.0"
177
172
  },