@apdesign/code-style-react 2.0.0 → 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.
Files changed (3) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/biome.jsonc +10 -37
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,75 @@
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
+
51
+ ## [2.0.1] - 规则放宽版本
52
+
53
+ ### 🔧 调整
54
+
55
+ - **放宽 Biome Linter 规则**: 参考原 ESLint 配置,将规则调整得更宽松
56
+ - 关闭文件命名约定检查 (`useFilenamingConvention`)
57
+ - 关闭 Node.js import 协议强制 (`useNodejsImportProtocol`)
58
+ - 关闭魔术数字检查 (`noMagicNumbers`)
59
+ - 关闭正则表达式顶层声明要求 (`useTopLevelRegex`)
60
+ - 关闭未使用函数参数检查 (`noUnusedFunctionParameters`)
61
+ - 关闭代码复杂度检查 (`noExcessiveCognitiveComplexity`)
62
+ - 关闭多余模板字符串检查 (`noUnusedTemplateLiteral`)
63
+ - 关闭否定判断优化建议 (`noNegationElse`)
64
+ - 将多个 `error` 级别降为 `warn` 级别
65
+ - 关闭类型约束相关的严格检查
66
+
67
+ ### 📝 说明
68
+
69
+ 此版本的规则配置更接近原 ESLint 的宽松风格,专注于必要的代码质量检查,避免过于严格的代码风格限制。
70
+
71
+ ---
72
+
3
73
  ## [2.0.0] - Ultracite 迁移版本
4
74
 
5
75
  ### 🎉 重大变更
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,56 +23,42 @@
24
23
  "linter": {
25
24
  "enabled": true,
26
25
  "rules": {
27
- "recommended": false,
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": "error",
35
33
  "noUselessConstructor": "error",
36
34
  "noUselessFragments": "off",
37
- "noUselessTypeConstraint": "error",
38
- "noForEach": "off"
35
+ "noForEach": "off",
36
+ "noExcessiveCognitiveComplexity": "off"
39
37
  },
40
38
  "correctness": {
41
- "noPrecisionLoss": "error",
42
39
  "noUndeclaredVariables": "off",
43
40
  "noUnusedVariables": "warn",
44
41
  "useExhaustiveDependencies": "off"
45
42
  },
46
43
  "style": {
47
- "noNamespace": "error",
48
44
  "noParameterAssign": "warn",
49
- "useArrayLiterals": "error",
50
- "useAsConstAssertion": "error",
45
+ "noNonNullAssertion": "off",
51
46
  "useBlockStatements": "off",
52
47
  "useNamingConvention": "off",
53
48
  "useTemplate": "warn",
54
- "useFilenamingConvention": "off"
49
+ "useFilenamingConvention": "off",
50
+ "useNodejsImportProtocol": "off"
55
51
  },
56
52
  "suspicious": {
57
- "noEmptyBlockStatements": "error",
58
53
  "noExplicitAny": "warn",
59
- "noExtraNonNullAssertion": "error",
60
- "noMisleadingInstantiator": "error",
61
- "noUnsafeDeclarationMerging": "error",
62
54
  "noArrayIndexKey": "warn",
63
- "noShadowRestrictedNames": "warn",
64
- "noConsole": "off"
55
+ "noConsole": "off",
56
+ "noDoubleEquals": "off"
65
57
  }
66
58
  }
67
59
  },
68
60
  "files": {
69
- "includes": [
70
- "**/*.js",
71
- "**/*.jsx",
72
- "**/*.ts",
73
- "**/*.tsx",
74
- "**/*.json",
75
- "**/*.jsonc"
76
- ],
61
+ "includes": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx", "**/*.json", "**/*.jsonc"],
77
62
  "experimentalScannerIgnores": [
78
63
  "**/dist/**",
79
64
  "**/node_modules/**",
@@ -83,17 +68,5 @@
83
68
  "**/build/**",
84
69
  "**/coverage/**"
85
70
  ]
86
- },
87
- "overrides": [
88
- {
89
- "includes": ["scripts/runEslint.js", "scripts/runStylelint.js"],
90
- "linter": {
91
- "rules": {
92
- "complexity": {
93
- "noExcessiveCognitiveComplexity": "off"
94
- }
95
- }
96
- }
97
- }
98
- ]
71
+ }
99
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apdesign/code-style-react",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "基于 Ultracite (Biome) 的现代化前端代码规范工具集,专为 React/TypeScript 项目设计",
5
5
  "keywords": [
6
6
  "biome",