feat: 配置 Biome 代码格式化与校验工具

添加 biome.json 配置(formatter + linter + organizeImports),
.editorconfig 统一编辑器配置,package.json 新增 lint/format scripts。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
claude-code-best 2026-04-01 01:40:27 +08:00
parent 2de3d309b4
commit 074ea844dc
4 changed files with 106 additions and 2 deletions

16
.editorconfig Normal file
View File

@ -0,0 +1,16 @@
root = true
[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[*.{json,yml,yaml}]
indent_style = space
indent_size = 2

View File

@ -13,4 +13,10 @@
<!-- - [ ] `@ant/computer-use-swift` — Computer Use Swift 原生模块
- [ ] `@ant/computer-use-mcp` — Computer Use MCP 服务
- [ ] `@ant/computer-use-input` — Computer Use 输入模块
- [ ] `@ant/claude-for-chrome-mcp` — Chrome MCP 扩展 -->
- [ ] `@ant/claude-for-chrome-mcp` — Chrome MCP 扩展 -->
## 工程化能力
- [x] 代码格式化与校验
- [ ] 冗余代码检查
- [ ] git hook 的配置

79
biome.json Normal file
View File

@ -0,0 +1,79 @@
{
"$schema": "https://biomejs.dev/schemas/2.4.10/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"includes": ["**", "!!**/dist", "!!**/packages/@ant"]
},
"formatter": {
"enabled": true,
"indentStyle": "tab",
"lineWidth": 120
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "off",
"noAssignInExpressions": "off",
"noDoubleEquals": "off",
"noRedeclare": "off",
"noImplicitAnyLet": "off",
"noGlobalIsNan": "off",
"noFallthroughSwitchClause": "off",
"noShadowRestrictedNames": "off"
},
"style": {
"useConst": "off",
"noNonNullAssertion": "off",
"noParameterAssign": "off",
"useDefaultParameterLast": "off",
"noUnusedTemplateLiteral": "off",
"useTemplate": "off",
"useNumberNamespace": "off"
},
"complexity": {
"noForEach": "off",
"noBannedTypes": "off",
"noUselessConstructor": "off",
"noStaticOnlyClass": "off",
"useOptionalChain": "off",
"noUselessSwitchCase": "off",
"noUselessFragments": "off",
"noUselessTernary": "off",
"noUselessLoneBlockStatements": "off"
},
"correctness": {
"noUnusedVariables": "off",
"noUnusedImports": "off",
"useExhaustiveDependencies": "off",
"noSwitchDeclarations": "off",
"noUnreachable": "off",
"useHookAtTopLevel": "off"
},
"a11y": {
"recommended": false
},
"nursery": {
"recommended": false
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "double"
}
},
"assist": {
"enabled": true,
"actions": {
"source": {
"organizeImports": "on"
}
}
}
}

View File

@ -12,7 +12,10 @@
"scripts": {
"build": "bun build src/entrypoints/cli.tsx --outdir dist --target bun",
"dev": "bun run src/entrypoints/cli.tsx",
"prepublishOnly": "bun run build"
"prepublishOnly": "bun run build",
"lint": "biome check src/",
"lint:fix": "biome check --fix src/",
"format": "biome format --write src/"
},
"dependencies": {
"@alcalzone/ansi-tokenize": "^0.3.0",