Merge pull request #3 from Yaosanqi137/feature/p1-code-quality-hooks

Feature/p1 code quality hooks
This commit is contained in:
Yaosanqi137
2026-04-04 12:43:29 +08:00
committed by GitHub
10 changed files with 1291 additions and 30 deletions
+2
View File
@@ -2,3 +2,5 @@ develop.md
node_modules/
.turbo/
.idea/
.eslintcache
/.husky/_
+1
View File
@@ -0,0 +1 @@
pnpm lint:staged
+2
View File
@@ -0,0 +1,2 @@
pnpm typecheck
pnpm test
+4
View File
@@ -0,0 +1,4 @@
module.exports = {
"*.{js,mjs,cjs,ts,tsx}": ["eslint --fix", "prettier --write"],
"*.{json,md,yml,yaml}": ["prettier --write"]
};
+7
View File
@@ -0,0 +1,7 @@
node_modules
.turbo
.idea
dist
build
coverage
*.png
+6
View File
@@ -0,0 +1,6 @@
{
"semi": true,
"singleQuote": false,
"trailingComma": "none",
"printWidth": 100
}
+69
View File
@@ -0,0 +1,69 @@
# 贡献指南(Contributing
本文档定义 TodoList 仓库的协作规范,所有贡献者提交代码前请先阅读。
## 1. 分支模型
- 长期分支:
- `main`:生产稳定分支
- `develop`:开发集成分支
- 功能分支:
- 命名:`feature/<phase>-<name>`
- 示例:`feature/p1-code-quality-hooks`
- 其他分支:
- `release/<version>`
- `hotfix/<issue-id>-<short-desc>`
## 2. 提交流程
1. 从目标基线分支切出功能分支。
2. 每完成一个小功能,提交一个最小 commit。
3. 完成后推送分支并创建 PR。
4. 通过 Code Review 后再合并到目标分支。
## 3. Commit 规范
- 使用 Conventional Commits
- `feat(scope): ...`
- `fix(scope): ...`
- `chore(scope): ...`
- `docs(scope): ...`
- `test(scope): ...`
- `ci(scope): ...`
- 要求:
- commit 粒度最小化,不要把多个不相关改动塞进一个提交。
- commit 必须可回滚、可解释。
- 默认使用 GPG 签名提交:`git commit -S`
## 4. PR 规范
- PR 标题简明描述变更目标。
- PR 描述至少包含:
- 变更概述
- 具体改动
- 测试结果
- 风险评估
- 回滚方案
- 一个 PR 只解决一类问题,避免“超大 PR”。
## 5. 代码质量检查
提交前建议至少执行:
```bash
pnpm install
pnpm run lint
pnpm run typecheck
pnpm run test
```
说明:
- `pre-commit` 会自动执行 `lint-staged`
- `pre-push` 会自动执行 `typecheck + test`
## 6. 变更边界要求
- 不要提交无关文件(例如本地 IDE 缓存、临时导出文件)。
- 不要随意修改与当前任务无关的历史代码。
- 如发现仓库出现非本人预期改动,先暂停并和维护者确认。
+29
View File
@@ -0,0 +1,29 @@
import js from "@eslint/js";
import globals from "globals";
export default [
{
ignores: ["**/node_modules/**", "**/.turbo/**", "**/dist/**", "**/build/**"]
},
js.configs.recommended,
{
files: ["**/*.{js,mjs}"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.node
}
}
},
{
files: ["**/*.cjs"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "commonjs",
globals: {
...globals.node
}
}
}
];
+10 -2
View File
@@ -7,9 +7,11 @@
"test": "turbo run test",
"dev": "turbo run dev --parallel",
"build": "turbo run build",
"lint": "turbo run lint",
"lint": "turbo run lint && eslint .",
"typecheck": "turbo run typecheck",
"format": "turbo run format"
"format": "prettier --write .",
"lint:staged": "lint-staged",
"prepare": "husky"
},
"keywords": [],
"author": "",
@@ -17,6 +19,12 @@
"private": true,
"packageManager": "pnpm@9.15.2",
"devDependencies": {
"@eslint/js": "^10.0.1",
"eslint": "^10.2.0",
"globals": "^17.4.0",
"husky": "^9.1.7",
"lint-staged": "^16.4.0",
"prettier": "^3.8.1",
"turbo": "^2.9.3"
}
}
+1161 -28
View File
File diff suppressed because it is too large Load Diff