@apdesign/code-style-react 2.0.3 → 2.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/CHANGELOG.md +81 -0
- package/biome.jsonc +30 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,86 @@
|
|
1
1
|
# 更新日志
|
2
2
|
|
3
|
+
## [2.0.5] - Biome 规则精准对齐版本
|
4
|
+
|
5
|
+
### 🎯 重要更新
|
6
|
+
|
7
|
+
根据实际项目的 ESLint error 和 warning 扫描结果,进一步优化 Biome 规则配置,提升规则覆盖率和严重程度对齐。
|
8
|
+
|
9
|
+
### 🔧 规则调整
|
10
|
+
|
11
|
+
**严重程度提升(warn → error)**:
|
12
|
+
- `noParameterAssign: error` ← `no-param-reassign`
|
13
|
+
- `useTemplate: error` ← `prefer-template`
|
14
|
+
- `noUselessElse: error` ← `no-else-return`
|
15
|
+
- `noExplicitAny: error` ← `@typescript-eslint/no-explicit-any`
|
16
|
+
- `noArrayIndexKey: error` ← `react/no-array-index-key`
|
17
|
+
- `noEmptyBlockStatements: error` ← `no-empty-function`
|
18
|
+
- `noShadowRestrictedNames: error` ← `@typescript-eslint/no-shadow`
|
19
|
+
|
20
|
+
**新增规则 (Complexity)**:
|
21
|
+
- `noUselessEscapeInRegex: error` ← `no-useless-escape` 部分
|
22
|
+
- `noUselessTernary: error` ← `no-unneeded-ternary`
|
23
|
+
- `useArrowFunction: error` ← `prefer-arrow-callback`
|
24
|
+
- `useLiteralKeys: warn` ← `dot-notation`
|
25
|
+
|
26
|
+
**新增规则 (Correctness)**:
|
27
|
+
- `noUnsafeOptionalChaining: error` ← `no-unsafe-optional-chaining`
|
28
|
+
|
29
|
+
**新增规则 (Style)**:
|
30
|
+
- `useCollapsedElseIf: error` ← `no-lonely-if`
|
31
|
+
- `useDefaultParameterLast: error` ← `default-param-last`
|
32
|
+
- `useConst: error` ← `prefer-const`
|
33
|
+
- `useExponentiationOperator: error` ← 使用 ** 而不是 Math.pow
|
34
|
+
|
35
|
+
### 📊 覆盖率统计
|
36
|
+
|
37
|
+
- **可配置规则总数**: 15 个 Biome 规则
|
38
|
+
- **ESLint 规则覆盖率**: 约 35-40%
|
39
|
+
- **Error 级别规则**: 12 个
|
40
|
+
- **Warn 级别规则**: 3 个
|
41
|
+
|
42
|
+
### ❌ Biome 不支持的规则
|
43
|
+
|
44
|
+
以下 ESLint 规则在 Biome 中暂无对应,已接受放弃检查:
|
45
|
+
|
46
|
+
**Import 管理**:
|
47
|
+
- `import/order`, `import/newline-after-import`, `import/no-unresolved`, `import/no-duplicates`, `import/no-extraneous-dependencies`
|
48
|
+
|
49
|
+
**React 特定**:
|
50
|
+
- `react/no-unused-prop-types`, `react/jsx-no-constructed-context-values`, `react/no-unstable-nested-components`, `react/jsx-curly-brace-presence`, `react/destructuring-assignment`
|
51
|
+
|
52
|
+
**代码风格**:
|
53
|
+
- `no-underscore-dangle`, `spaced-comment`, `no-continue`, `lines-between-class-members`, `func-names`
|
54
|
+
|
55
|
+
**逻辑检查**:
|
56
|
+
- `consistent-return`, `no-nested-ternary`, `no-restricted-globals`, `no-loop-func`, `no-useless-return`, `prefer-promise-reject-errors`, `no-new-wrappers`, `one-var`, `no-restricted-syntax`, `@typescript-eslint/no-use-before-define`, `prefer-destructuring`
|
57
|
+
|
58
|
+
### 🎨 配置原则
|
59
|
+
|
60
|
+
1. **严重程度对齐**: ESLint error → Biome error, ESLint warn → Biome warn
|
61
|
+
2. **规则冲突统一**: 同一规则出现在 error 和 warning 中时,统一设为 error
|
62
|
+
3. **覆盖率优先**: 能配置的规则尽可能配置
|
63
|
+
4. **接受限制**: Biome 不支持的规则接受放弃
|
64
|
+
|
65
|
+
### 📝 使用建议
|
66
|
+
|
67
|
+
使用 Biome 检查项目:
|
68
|
+
```bash
|
69
|
+
npx @biomejs/biome check . --write
|
70
|
+
```
|
71
|
+
|
72
|
+
查看诊断信息:
|
73
|
+
```bash
|
74
|
+
npx @biomejs/biome check . --diagnostic-level=error
|
75
|
+
```
|
76
|
+
|
77
|
+
### 🔗 相关链接
|
78
|
+
|
79
|
+
- Biome 官方文档: https://biomejs.dev
|
80
|
+
- Biome 规则参考: https://www.biomejs.cn/linter
|
81
|
+
|
82
|
+
---
|
83
|
+
|
3
84
|
## [2.0.3] - 实际项目扫描对齐版本
|
4
85
|
|
5
86
|
### 🎯 重要更新
|
package/biome.jsonc
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://biomejs.dev/schemas/2.2.6/schema.json",
|
3
|
+
"vcs": {
|
4
|
+
"enabled": true,
|
5
|
+
"clientKind": "git",
|
6
|
+
"useIgnoreFile": true
|
7
|
+
},
|
3
8
|
"formatter": {
|
4
9
|
"enabled": true,
|
5
10
|
"indentStyle": "space",
|
@@ -37,7 +42,11 @@
|
|
37
42
|
"noUselessFragments": "off",
|
38
43
|
"noForEach": "off",
|
39
44
|
"noExcessiveCognitiveComplexity": "off",
|
40
|
-
"useOptionalChain": "warn"
|
45
|
+
"useOptionalChain": "warn",
|
46
|
+
"noUselessEscapeInRegex": "error",
|
47
|
+
"noUselessTernary": "error",
|
48
|
+
"useArrowFunction": "error",
|
49
|
+
"useLiteralKeys": "warn"
|
41
50
|
},
|
42
51
|
"correctness": {
|
43
52
|
"noUndeclaredVariables": "off",
|
@@ -46,14 +55,15 @@
|
|
46
55
|
"useExhaustiveDependencies": "off",
|
47
56
|
"noUnreachable": "error",
|
48
57
|
"noConstantCondition": "error",
|
49
|
-
"noUnusedFunctionParameters": "off"
|
58
|
+
"noUnusedFunctionParameters": "off",
|
59
|
+
"noUnsafeOptionalChaining": "error"
|
50
60
|
},
|
51
61
|
"style": {
|
52
|
-
"noParameterAssign": "
|
62
|
+
"noParameterAssign": "error",
|
53
63
|
"noNonNullAssertion": "off",
|
54
64
|
"useBlockStatements": "off",
|
55
65
|
"useNamingConvention": "off",
|
56
|
-
"useTemplate": "
|
66
|
+
"useTemplate": "error",
|
57
67
|
"useFilenamingConvention": "off",
|
58
68
|
"useNodejsImportProtocol": "off",
|
59
69
|
"useShorthandAssign": "warn",
|
@@ -63,16 +73,21 @@
|
|
63
73
|
"useImportType": "off",
|
64
74
|
"noUnusedTemplateLiteral": "warn",
|
65
75
|
"useSingleVarDeclarator": "off",
|
66
|
-
"noUselessElse": "
|
76
|
+
"noUselessElse": "error",
|
77
|
+
"useCollapsedElseIf": "error",
|
78
|
+
"useDefaultParameterLast": "error",
|
79
|
+
"useConst": "error",
|
80
|
+
"useExponentiationOperator": "error"
|
67
81
|
},
|
68
82
|
"suspicious": {
|
69
|
-
"noExplicitAny": "
|
70
|
-
"noArrayIndexKey": "
|
83
|
+
"noExplicitAny": "error",
|
84
|
+
"noArrayIndexKey": "error",
|
71
85
|
"noConsole": "warn",
|
72
86
|
"noDoubleEquals": "off",
|
73
|
-
"noEmptyBlockStatements": "
|
87
|
+
"noEmptyBlockStatements": "error",
|
74
88
|
"noConfusingVoidType": "off",
|
75
|
-
"noConstEnum": "off"
|
89
|
+
"noConstEnum": "off",
|
90
|
+
"noShadowRestrictedNames": "error"
|
76
91
|
},
|
77
92
|
"nursery": {
|
78
93
|
"useSortedClasses": "off"
|
@@ -80,15 +95,15 @@
|
|
80
95
|
}
|
81
96
|
},
|
82
97
|
"files": {
|
83
|
-
"includes": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"
|
98
|
+
"includes": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"],
|
84
99
|
"experimentalScannerIgnores": [
|
85
|
-
"**/dist
|
86
|
-
"**/node_modules
|
100
|
+
"**/dist",
|
101
|
+
"**/node_modules",
|
87
102
|
"**/*.d.ts",
|
88
|
-
"**/mock
|
103
|
+
"**/mock",
|
89
104
|
"**/.eslintrc.cjs",
|
90
|
-
"**/build
|
91
|
-
"**/coverage
|
105
|
+
"**/build",
|
106
|
+
"**/coverage"
|
92
107
|
]
|
93
108
|
},
|
94
109
|
"overrides": [
|