chore(biome): 强化 lint 规则 — 用工具约束 coding conventions

- noDefaultExport: 禁止 default export
- noParameterProperties: 禁止 class 参数属性
- noNamespace: 禁止 namespace
- noExplicitAny: 禁止 any
- noUnusedVariables/Imports: 禁止未使用变量和 import
- noForEach: 用 for-of 替代
- useArrowFunction: 回调用箭头函数
- useImportType: type-only import
- useConst/noVar: 不可变优先
- noStaticOnlyClass: 禁止纯静态 class(用函数)
- cognitive complexity <= 15
This commit is contained in:
2026-04-22 06:31:34 +00:00
parent d643ccf5af
commit 3b22fde79c
+25 -2
View File
@@ -29,13 +29,36 @@
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noDefaultExport": "error",
"useNodejsImportProtocol": "error"
"useNodejsImportProtocol": "error",
"noNamespace": "error",
"noParameterProperties": "error",
"useImportType": "error",
"useShorthandFunctionType": "error",
"noVar": "error",
"useConst": "error",
"useEnumInitializers": "error"
},
"complexity": {
"noThisInStatic": "error",
"noStaticOnlyClass": "error"
"noStaticOnlyClass": "error",
"noForEach": "error",
"useArrowFunction": "error",
"noExcessiveCognitiveComplexity": {
"level": "warn",
"options": {
"maxAllowedComplexity": 15
}
}
},
"suspicious": {
"noExplicitAny": "error"
},
"correctness": {
"noUnusedVariables": "error",
"noUnusedImports": "error"
}
}
}