@huangjunsen/eslint-config 1.0.4 → 1.0.5

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/flat/react.js CHANGED
@@ -4,6 +4,26 @@ const jsxA11y = require('eslint-plugin-jsx-a11y');
4
4
  const tsParser = require('@typescript-eslint/parser');
5
5
  const { prettierOverrides } = require('./shared');
6
6
 
7
+ /**
8
+ * React Hooks 经典规则
9
+ *
10
+ * eslint-plugin-react-hooks v7 的 `recommended` 预设新增了 14 条 React Compiler
11
+ * 相关规则(purity / immutability / refs / set-state-in-effect …),且大多为 error 级别。
12
+ * 这些规则用于配合 React Compiler 使用,在既有项目上会产生大量改动量极大的告警,
13
+ * 因此此处仅保留长期稳定、业界公认的两条经典规则;
14
+ * 需要启用编译器规则的项目可自行 extend:
15
+ *
16
+ * import reactHooks from 'eslint-plugin-react-hooks';
17
+ * export default [
18
+ * ...vueConfig,
19
+ * { plugins: { 'react-hooks': reactHooks }, rules: reactHooks.configs.recommended.rules },
20
+ * ];
21
+ */
22
+ const reactHooksRules = {
23
+ 'react-hooks/rules-of-hooks': 'error',
24
+ 'react-hooks/exhaustive-deps': 'warn',
25
+ };
26
+
7
27
  /**
8
28
  * React Flat Config 配置
9
29
  */
@@ -27,7 +47,7 @@ module.exports = [
27
47
  },
28
48
  rules: {
29
49
  ...react.configs.recommended.rules,
30
- ...reactHooks.configs.recommended.rules,
50
+ ...reactHooksRules,
31
51
  ...jsxA11y.configs.recommended.rules,
32
52
  },
33
53
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huangjunsen/eslint-config",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "main": "index.js",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -26,6 +26,15 @@
26
26
  "node",
27
27
  "lint"
28
28
  ],
29
+ "peerDependencies": {
30
+ "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
31
+ "typescript": ">=4.8.4 <6.1.0"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "typescript": {
35
+ "optional": true
36
+ }
37
+ },
29
38
  "author": "Huangjunsen <951434130@qq.com>",
30
39
  "homepage": "https://github.com/Huang-junsen/js-encode-fe-spec#readme",
31
40
  "license": "ISC",
@@ -42,24 +51,23 @@
42
51
  "@babel/preset-react": "^7.24.1",
43
52
  "@typescript-eslint/eslint-plugin": "^8.70.0",
44
53
  "@typescript-eslint/parser": "^8.70.0",
45
- "eslint-config-egg": "^13.1.0",
54
+ "eslint-config-egg": "^14.1.0",
46
55
  "eslint-config-prettier": "^10.1.8",
47
- "eslint-import-resolver-typescript": "^3.6.1",
56
+ "eslint-import-resolver-typescript": "^4.4.5",
48
57
  "eslint-plugin-import": "^2.29.1",
49
58
  "eslint-plugin-jsx-a11y": "^6.8.0",
50
- "eslint-plugin-jsx-plus": "^0.1.0",
51
59
  "eslint-plugin-react": "^7.34.1",
52
- "eslint-plugin-react-hooks": "^4.6.0",
60
+ "eslint-plugin-react-hooks": "^7.1.1",
53
61
  "eslint-plugin-vue": "^10.11.0",
54
- "globals": "^15.0.0",
62
+ "globals": "^17.12.0",
55
63
  "lodash": "^4.17.21",
56
64
  "typescript-eslint": "^8.70.0",
57
65
  "vue-eslint-parser": "^10.4.1"
58
66
  },
59
67
  "devDependencies": {
60
- "eslint": "^8.7.0",
68
+ "eslint": "^8.57.0",
61
69
  "mocha": "^10.4.0",
62
- "typescript": "5.0.4"
70
+ "typescript": "^5.0.4"
63
71
  },
64
72
  "scripts": {
65
73
  "lint": "eslint ./",
package/rules/react.js CHANGED
@@ -91,9 +91,6 @@ module.exports = {
91
91
  },
92
92
  ],
93
93
 
94
- // 本条废弃,用新规则代替 react/jsx-sort-props
95
- 'react/jsx-sort-prop-types': 'off',
96
-
97
94
  // 属性按首字母排序
98
95
  'react/jsx-sort-props': [
99
96
  'off',