- 安装 husky 和 lint-staged 用于 Git hooks 管理 - 配置 pre-commit 检查:ESLint、TypeScript、Prettier - 添加 Prettier 代码格式化配置和插件 - 更新项目文档说明 pre-commit 工作流程 - 配置文件包括: - .husky/pre-commit: Git pre-commit hook 脚本 - lint-staged.config.js: lint-staged 配置 - frontend/.prettierrc: Prettier 配置 - frontend/.prettierignore: Prettier 忽略文件 现在每次提交前会自动运行代码检查和格式化
9 lines
208 B
Bash
Executable File
9 lines
208 B
Bash
Executable File
#!/bin/sh
|
|
# 进入 frontend 目录并运行 pre-commit 检查
|
|
|
|
export PATH="$HOME/.bun/bin:$PATH"
|
|
|
|
echo "🔍 Running pre-commit checks..."
|
|
|
|
# 运行 lint-staged
|
|
npx lint-staged --config lint-staged.config.js |