#!/bin/sh echo "πŸ” Running pre-commit checks..." # 前端检ζŸ₯ echo "πŸ“¦ Checking frontend..." # TypeScript ζ£€ζŸ₯ echo " β†’ TypeScript check..." npx tsc --noEmit if [ $? -ne 0 ]; then echo "❌ TypeScript check failed!" exit 1 fi # ESLint ζ£€ζŸ₯ echo " β†’ ESLint check..." npm run lint if [ $? -ne 0 ]; then echo "❌ ESLint check failed!" exit 1 fi # Prettier ζ£€ζŸ₯ echo " β†’ Prettier check..." npx prettier --check "src/**/*.{ts,tsx,css}" if [ $? -ne 0 ]; then echo "❌ Prettier check failed! Run 'npm run format' to fix." exit 1 fi # Rust ζ£€ζŸ₯ echo "πŸ¦€ Checking Rust..." # Rust 格式检ζŸ₯ echo " β†’ Rust format check..." cd src-tauri cargo fmt --all -- --check if [ $? -ne 0 ]; then echo "❌ Rust format check failed! Run 'cargo fmt' in src-tauri to fix." exit 1 fi # Rust ηΌ–θ―‘ζ£€ζŸ₯ (不使用δΈ₯ζ Όηš„ clippy) echo " β†’ Rust build check..." cargo check --all-targets if [ $? -ne 0 ]; then echo "❌ Rust build check failed!" exit 1 fi cd .. echo "βœ… All pre-commit checks passed!"