docs: 补充 lint/format 开发文档

This commit is contained in:
2026-06-09 14:30:27 +08:00
parent 34974714a2
commit 6ebfe24921

View File

@@ -47,6 +47,24 @@ bun src/cli.ts help init # 查看 init 命令帮助
bun src/cli.ts version # 查看版本号 bun src/cli.ts version # 查看版本号
``` ```
### 代码质量
项目使用 oxlint 进行静态分析oxfmt 进行代码格式化,提交时通过 husky + lint-staged 自动检查。
```bash
bun lint # 静态分析所有文件
bun format # 格式化所有文件(写回)
bun format:check # 检查格式不写回CI 用)
bun check # 一键 lint + 格式检查
```
**配置文件:**
- `.oxlintrc.json` — oxlint 规则配置correctness + suspicious 全开style 选开)
- `.oxfmtrc.json` — oxfmt 格式设置双引号、分号、尾逗号、2 空格缩进、100 行宽、LF 换行)
**pre-commit hook** 提交时自动对 staged 文件运行 lint 和格式化lint 失败会阻止提交。
## CLI 交互架构 ## CLI 交互架构
### 子命令 ### 子命令