1 Commits

Author SHA1 Message Date
Yaosanqi137 e967c599d9 Merge pull request #3 from Yaosanqi137/feature/p1-code-quality-hooks
Feature/p1 code quality hooks
2026-04-04 12:43:29 +08:00
25 changed files with 1539 additions and 1 deletions
+5 -1
View File
@@ -1,2 +1,6 @@
develop.md develop.md
.idea/ 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 缓存、临时导出文件)。
- 不要随意修改与当前任务无关的历史代码。
- 如发现仓库出现非本人预期改动,先暂停并和维护者确认。
View File
View File
View File
+62
View File
@@ -0,0 +1,62 @@
# ADR-XXXX<决策标题>
- 状态:Proposed | Accepted | Deprecated | Superseded
- 日期:YYYY-MM-DD
- 决策人:<团队/人员>
- 关联需求:<Issue/PR/文档链接>
## 背景
描述当前问题、约束条件,以及为什么现在必须做出这项决策。
## 决策驱动因素
- <驱动因素 1>
- <驱动因素 2>
- <驱动因素 3>
## 可选方案
1. <方案 A>
2. <方案 B>
3. <方案 C>
## 最终决策
选择方案:**<方案 X>**
说明选择该方案的理由,以及未选择其他方案的原因。
## 影响评估
### 正向影响
- <收益 1>
- <收益 2>
### 负向影响 / 取舍
- <代价 1>
- <代价 2>
## 实施计划
1. <步骤 1>
2. <步骤 2>
3. <步骤 3>
## 回滚方案
说明当风险发生时,如何撤销或回退这项决策。
## 验证清单
- [ ] 单元测试
- [ ] 集成测试
- [ ] 性能检查
- [ ] 安全检查
## 参考资料
- <参考资料 1>
- <参考资料 2>
+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
}
}
}
];
+30
View File
@@ -0,0 +1,30 @@
{
"name": "todolist",
"version": "0.1.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "turbo run test",
"dev": "turbo run dev --parallel",
"build": "turbo run build",
"lint": "turbo run lint && eslint .",
"typecheck": "turbo run typecheck",
"format": "prettier --write .",
"lint:staged": "lint-staged",
"prepare": "husky"
},
"keywords": [],
"author": "",
"license": "GPL-3.0-or-later",
"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"
}
}
+16
View File
@@ -0,0 +1,16 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
env: {
browser: true,
es2022: true,
node: true
},
parserOptions: {
ecmaVersion: "latest",
sourceType: "module"
},
rules: {
"no-console": "warn",
"no-debugger": "error"
}
};
+11
View File
@@ -0,0 +1,11 @@
{
"name": "@todolist/eslint-config",
"version": "0.1.0",
"description": "Shared ESLint config presets for TodoList",
"main": "base.cjs",
"license": "GPL-3.0-or-later",
"private": true,
"files": [
"base.cjs"
]
}
View File
View File
+17
View File
@@ -0,0 +1,17 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"noImplicitOverride": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true
}
}
+13
View File
@@ -0,0 +1,13 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./base.json",
"compilerOptions": {
"module": "CommonJS",
"moduleResolution": "Node",
"lib": ["ES2022"],
"types": ["node"],
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"sourceMap": true
}
}
+12
View File
@@ -0,0 +1,12 @@
{
"name": "@todolist/tsconfig",
"version": "0.1.0",
"description": "Shared TypeScript config presets for TodoList",
"license": "GPL-3.0-or-later",
"private": true,
"files": [
"base.json",
"react-app.json",
"nest-app.json"
]
}
+9
View File
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./base.json",
"compilerOptions": {
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"jsx": "react-jsx",
"types": ["vite/client"]
}
}
View File
+1215
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -0,0 +1,3 @@
packages:
- "apps/*"
- "packages/*"
+28
View File
@@ -0,0 +1,28 @@
{
"$schema": "https://turbo.build/schema.json",
"tasks": {
"dev": {
"cache": false,
"persistent": true
},
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", "build/**"]
},
"lint": {
"dependsOn": ["^lint"],
"outputs": []
},
"test": {
"dependsOn": ["^test"],
"outputs": ["coverage/**"]
},
"typecheck": {
"dependsOn": ["^typecheck"],
"outputs": []
},
"format": {
"outputs": []
}
}
}