Files
menav/.husky/pre-commit
rbetree f2f59108a0 chore: 提交时自动格式化代码
- 安装 husky (^9.1.7) 和 lint-staged (^16.2.7)
- 配置 pre-commit hook 自动运行 Prettier
- 创建 .prettierignore 排除不需要格式化的文件
2026-01-16 16:34:47 +08:00

11 lines
444 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env sh
# 进入仓库根目录,避免在子目录执行 git commit 时找不到脚本/依赖
cd "$(dirname "$0")/.." || exit 1
# Windows Git Bash 下如果需要中文输出不乱码,可在个人环境中设置终端编码/locale
# 这里不强制设置 LANG/LC_ALL避免在 Linux/macOS 上因 locale 不存在而产生警告
# 优先使用项目内的 lint-staged避免依赖全局 PATH
./node_modules/.bin/lint-staged