@pengzhanbo/eslint-config 2.2.0 → 2.3.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 +875 -554
  2. package/dist/index.mjs +14 -103
  3. package/package.json +32 -37
package/dist/index.mjs CHANGED
@@ -433,6 +433,10 @@ async function e18e(options = {}) {
433
433
  ...modernization ? { ...configs.modernization.rules } : {},
434
434
  ...moduleReplacements ? { ...configs.moduleReplacements.rules } : {},
435
435
  ...performanceImprovements ? { ...configs.performanceImprovements.rules } : {},
436
+ "e18e/prefer-array-to-reversed": "off",
437
+ "e18e/prefer-array-to-sorted": "off",
438
+ "e18e/prefer-array-to-spliced": "off",
439
+ "e18e/prefer-spread-syntax": "off",
436
440
  ...overrides
437
441
  }
438
442
  }];
@@ -1353,24 +1357,12 @@ const ReactRouterPackages = [
1353
1357
  "@react-router/dev"
1354
1358
  ];
1355
1359
  const NextJsPackages = ["next"];
1356
- const ReactCompilerPackages = ["babel-plugin-react-compiler"];
1357
1360
  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
- ]);
1361
+ const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], overrides = {}, tsconfigPath } = options;
1362
+ await ensurePackages(["@eslint-react/eslint-plugin", "eslint-plugin-react-refresh"]);
1364
1363
  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
- ]);
1364
+ const typeAwareRules = { "react/no-leaked-conditional-rendering": "warn" };
1365
+ const [pluginReact, pluginReactRefresh] = await Promise.all([interopDefault(import("@eslint-react/eslint-plugin")), interopDefault(import("eslint-plugin-react-refresh"))]);
1374
1366
  const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => isPackageExists(i));
1375
1367
  const isUsingRemix = RemixPackages.some((i) => isPackageExists(i));
1376
1368
  const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
@@ -1381,13 +1373,7 @@ async function react(options = {}) {
1381
1373
  name: "config/react/setup",
1382
1374
  plugins: {
1383
1375
  "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"]
1376
+ "react-refresh": pluginReactRefresh
1391
1377
  }
1392
1378
  },
1393
1379
  {
@@ -1398,81 +1384,8 @@ async function react(options = {}) {
1398
1384
  },
1399
1385
  name: "config/react/rules",
1400
1386
  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",
1387
+ ...pluginReact.configs.recommended.rules,
1435
1388
  "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
1389
  "react-refresh/only-export-components": ["error", {
1477
1390
  allowConstantExport: isAllowConstantExport,
1478
1391
  allowExportNames: [...isUsingNext ? [
@@ -1509,10 +1422,7 @@ async function react(options = {}) {
1509
1422
  rules: {
1510
1423
  "react-dom/no-string-style-prop": "off",
1511
1424
  "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"
1425
+ "react/jsx-no-duplicate-props": "off"
1516
1426
  }
1517
1427
  },
1518
1428
  ...isTypeAware ? [{
@@ -2472,8 +2382,9 @@ const VuePackages = [
2472
2382
  const defaultPluginRenaming = {
2473
2383
  "@eslint-react": "react",
2474
2384
  "@eslint-react/dom": "react-dom",
2475
- "@eslint-react/hooks-extra": "react-hooks-extra",
2476
2385
  "@eslint-react/naming-convention": "react-naming-convention",
2386
+ "@eslint-react/rsc": "react-rsc",
2387
+ "@eslint-react/web-api": "react-web-api",
2477
2388
  "@next/next": "next",
2478
2389
  "@stylistic": "style",
2479
2390
  "@typescript-eslint": "ts",
@@ -2645,7 +2556,7 @@ const CONFIG_PRESET_FULL_ON = {
2645
2556
  nextjs: true,
2646
2557
  node: true,
2647
2558
  pnpm: true,
2648
- react: { reactCompiler: true },
2559
+ react: true,
2649
2560
  regexp: true,
2650
2561
  solid: true,
2651
2562
  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.3.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,21 +22,20 @@
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.2",
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",
31
+ "@unocss/eslint-plugin": "^66.6.7",
32
+ "astro-eslint-parser": "^1.4.0",
33
+ "eslint": "^10.1.0",
34
34
  "eslint-plugin-astro": "^1.6.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",
38
+ "eslint-plugin-svelte": "^3.17.0",
40
39
  "eslint-plugin-tailwindcss": "^3.18.2",
41
40
  "eslint-plugin-vue": "^10.8.0",
42
41
  "eslint-plugin-vuejs-accessibility": "^2.4.1",
@@ -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,30 +109,30 @@
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.0",
117
+ "@typescript-eslint/parser": "^8.58.0",
118
+ "@vitest/eslint-plugin": "^1.6.14",
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
138
  "globals": "^17.4.0",
@@ -146,23 +142,22 @@
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",
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.7",
149
+ "@eslint-react/eslint-plugin": "^4.2.3",
154
150
  "@eslint/config-inspector": "^1.5.0",
155
- "@next/eslint-plugin-next": "^16.1.6",
151
+ "@next/eslint-plugin-next": "^16.2.2",
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",
153
+ "@unocss/eslint-plugin": "^66.6.7",
154
+ "astro-eslint-parser": "^1.4.0",
155
+ "eslint": "^10.1.0",
160
156
  "eslint-plugin-astro": "^1.6.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",
160
+ "eslint-plugin-svelte": "^3.17.0",
166
161
  "eslint-plugin-tailwindcss": "^3.18.2",
167
162
  "eslint-plugin-vue": "^10.8.0",
168
163
  "eslint-plugin-vuejs-accessibility": "^2.5.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.1",
175
170
  "svelte-eslint-parser": "^1.6.0",
176
171
  "vue-eslint-parser": "^10.4.0"
177
172
  },