@apdesign/code-style-react 2.0.1 → 2.0.2
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/CHANGELOG.md +48 -0
- package/biome.jsonc +6 -41
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,53 @@
|
|
1
1
|
# 更新日志
|
2
2
|
|
3
|
+
## [2.0.2] - Airbnb 风格对齐版本
|
4
|
+
|
5
|
+
### 🎯 重要调整
|
6
|
+
|
7
|
+
- **启用 Biome recommended 规则**: 改为 `"recommended": true`,更贴合 Airbnb 的基础规则集
|
8
|
+
- **移除 ultracite 扩展**: 不再继承 ultracite 预设,使用更接近 Airbnb 的纯净配置
|
9
|
+
- **极简规则覆盖**: 只覆盖与 Airbnb + 自定义规则不同的部分
|
10
|
+
|
11
|
+
### 🔧 核心规则
|
12
|
+
|
13
|
+
**仅覆盖以下规则**(其他使用 Biome recommended 默认值):
|
14
|
+
|
15
|
+
**无障碍性 (a11y)**:
|
16
|
+
- 关闭交互性检查(与 Airbnb 一致)
|
17
|
+
|
18
|
+
**复杂度 (complexity)**:
|
19
|
+
- `noUselessConstructor: error`
|
20
|
+
- `noUselessFragments: off`
|
21
|
+
- `noForEach: off`
|
22
|
+
- `noExcessiveCognitiveComplexity: off`
|
23
|
+
|
24
|
+
**正确性 (correctness)**:
|
25
|
+
- `noUndeclaredVariables: off`
|
26
|
+
- `noUnusedVariables: warn`
|
27
|
+
- `useExhaustiveDependencies: off`(React hooks)
|
28
|
+
|
29
|
+
**风格 (style)**:
|
30
|
+
- `noParameterAssign: warn`
|
31
|
+
- `noNonNullAssertion: off`
|
32
|
+
- `useTemplate: warn`
|
33
|
+
- 关闭文件命名、Node.js 协议等约束
|
34
|
+
|
35
|
+
**可疑代码 (suspicious)**:
|
36
|
+
- `noExplicitAny: warn`
|
37
|
+
- `noArrayIndexKey: warn`
|
38
|
+
- `noConsole: off`
|
39
|
+
- `noDoubleEquals: off`
|
40
|
+
|
41
|
+
### 📝 设计理念
|
42
|
+
|
43
|
+
此版本完全对齐 **eslint-config-airbnb** 的宽松、实用风格:
|
44
|
+
- 启用 Biome 推荐规则作为基础
|
45
|
+
- 仅覆盖必要的差异配置
|
46
|
+
- 最大化兼容现有 Airbnb 项目
|
47
|
+
- 减少迁移时的代码调整
|
48
|
+
|
49
|
+
---
|
50
|
+
|
3
51
|
## [2.0.1] - 规则放宽版本
|
4
52
|
|
5
53
|
### 🔧 调整
|
package/biome.jsonc
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://biomejs.dev/schemas/2.2.6/schema.json",
|
3
|
-
"extends": ["ultracite"],
|
4
3
|
"formatter": {
|
5
4
|
"enabled": true,
|
6
5
|
"indentStyle": "space",
|
@@ -24,76 +23,42 @@
|
|
24
23
|
"linter": {
|
25
24
|
"enabled": true,
|
26
25
|
"rules": {
|
27
|
-
"recommended":
|
26
|
+
"recommended": true,
|
28
27
|
"a11y": {
|
29
28
|
"noNoninteractiveElementInteractions": "off",
|
30
29
|
"noStaticElementInteractions": "off",
|
31
30
|
"useKeyWithClickEvents": "off"
|
32
31
|
},
|
33
32
|
"complexity": {
|
34
|
-
"noBannedTypes": "off",
|
35
33
|
"noUselessConstructor": "error",
|
36
34
|
"noUselessFragments": "off",
|
37
|
-
"noUselessTypeConstraint": "off",
|
38
35
|
"noForEach": "off",
|
39
|
-
"noExcessiveCognitiveComplexity": "off"
|
40
|
-
"noVoid": "off"
|
36
|
+
"noExcessiveCognitiveComplexity": "off"
|
41
37
|
},
|
42
38
|
"correctness": {
|
43
|
-
"noPrecisionLoss": "warn",
|
44
39
|
"noUndeclaredVariables": "off",
|
45
40
|
"noUnusedVariables": "warn",
|
46
|
-
"
|
47
|
-
"noUnusedPrivateClassMembers": "warn",
|
48
|
-
"noUnusedFunctionParameters": "off",
|
49
|
-
"useExhaustiveDependencies": "off",
|
50
|
-
"noEmptyCharacterClassInRegex": "warn"
|
41
|
+
"useExhaustiveDependencies": "off"
|
51
42
|
},
|
52
43
|
"style": {
|
53
|
-
"noNamespace": "off",
|
54
44
|
"noParameterAssign": "warn",
|
55
45
|
"noNonNullAssertion": "off",
|
56
|
-
"useArrayLiterals": "off",
|
57
|
-
"useAsConstAssertion": "off",
|
58
46
|
"useBlockStatements": "off",
|
59
47
|
"useNamingConvention": "off",
|
60
48
|
"useTemplate": "warn",
|
61
49
|
"useFilenamingConvention": "off",
|
62
|
-
"
|
63
|
-
"useNodejsImportProtocol": "off",
|
64
|
-
"noUnusedTemplateLiteral": "off",
|
65
|
-
"useExponentiationOperator": "warn",
|
66
|
-
"noNegationElse": "off",
|
67
|
-
"noMagicNumbers": "off"
|
50
|
+
"useNodejsImportProtocol": "off"
|
68
51
|
},
|
69
52
|
"suspicious": {
|
70
|
-
"noEmptyBlockStatements": "warn",
|
71
53
|
"noExplicitAny": "warn",
|
72
|
-
"noExtraNonNullAssertion": "warn",
|
73
|
-
"noMisleadingInstantiator": "warn",
|
74
|
-
"noUnsafeDeclarationMerging": "warn",
|
75
54
|
"noArrayIndexKey": "warn",
|
76
|
-
"noShadowRestrictedNames": "warn",
|
77
55
|
"noConsole": "off",
|
78
|
-
"noDoubleEquals": "off"
|
79
|
-
"noPrototypeBuiltins": "off"
|
80
|
-
},
|
81
|
-
"performance": {
|
82
|
-
"noAccumulatingSpread": "off",
|
83
|
-
"noDelete": "off",
|
84
|
-
"useTopLevelRegex": "off"
|
56
|
+
"noDoubleEquals": "off"
|
85
57
|
}
|
86
58
|
}
|
87
59
|
},
|
88
60
|
"files": {
|
89
|
-
"includes": [
|
90
|
-
"**/*.js",
|
91
|
-
"**/*.jsx",
|
92
|
-
"**/*.ts",
|
93
|
-
"**/*.tsx",
|
94
|
-
"**/*.json",
|
95
|
-
"**/*.jsonc"
|
96
|
-
],
|
61
|
+
"includes": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx", "**/*.json", "**/*.jsonc"],
|
97
62
|
"experimentalScannerIgnores": [
|
98
63
|
"**/dist/**",
|
99
64
|
"**/node_modules/**",
|