chore: 更新 pre-commit 针对 Node 环境的检查和 lint-staged 执行

- 增加 Node 环境检查,确保在提交前 Node 可用
- 更新 lint-staged 执行方式以适应新的环境设置
- 清理 index.tsx 文件中的多余空行
This commit is contained in:
2026-04-03 21:13:29 +08:00
parent 171c54e29b
commit c206eb8132
2 changed files with 21 additions and 2 deletions

View File

@@ -1,3 +1,23 @@
#!/usr/bin/env sh #!/usr/bin/env sh
set -e set -e
yarn lint-staged cd "$(dirname "$0")/.." || exit 1
# SourceTree 等 GUI 的 PATH 通常没有 node先补常见安装位置
export PATH="/usr/local/bin:/opt/homebrew/bin:$HOME/.local/bin:$PATH"
if [ -s "$HOME/.nvm/nvm.sh" ]; then
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
# shellcheck source=/dev/null
. "$HOME/.nvm/nvm.sh"
fi
if command -v fnm >/dev/null 2>&1; then
eval "$(fnm env)"
fi
if ! command -v node >/dev/null 2>&1; then
echo "pre-commit: 找不到 node请安装 Node 或在 ~/.husky/pre-commit 里为 PATH 增加 node 所在目录。" >&2
exit 1
fi
exec node ./node_modules/lint-staged/bin/lint-staged.js

View File

@@ -179,7 +179,6 @@ export default function HomePage() {
> >
{sidebarContent} {sidebarContent}
</Drawer> </Drawer>
</Layout> </Layout>
); );
} }