fix: ESLint errors and update git hooks to include ESLint
All checks were successful
CI Pipeline / Rust Format Check (push) Successful in 2s
CI Pipeline / Clippy Lints (push) Successful in 46s
CI Pipeline / Rust Unit Tests (push) Successful in 1m2s
CI Pipeline / Security Audit (push) Successful in 4s
CI Pipeline / Frontend Lint & Type Check (push) Successful in 13s
CI Pipeline / Build .deb & Release (push) Successful in 3m19s
All checks were successful
CI Pipeline / Rust Format Check (push) Successful in 2s
CI Pipeline / Clippy Lints (push) Successful in 46s
CI Pipeline / Rust Unit Tests (push) Successful in 1m2s
CI Pipeline / Security Audit (push) Successful in 4s
CI Pipeline / Frontend Lint & Type Check (push) Successful in 13s
CI Pipeline / Build .deb & Release (push) Successful in 3m19s
- HostDetailPage.tsx: fix eqeqeq (!= to !==) - HostsPage.tsx: merge duplicate @mui/icons-material imports - PatchDeploymentPage.tsx: merge duplicate @mui/icons-material imports - pre-commit hook: add ESLint check - pre-push hook: add ESLint check
This commit is contained in:
@ -1071,7 +1071,7 @@ export default function HostDetailPage() {
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{check.last_result?.latency_ms != null ? `${check.last_result.latency_ms} ms` : '—'}
|
||||
{check.last_result?.latency_ms !== null && check.last_result?.latency_ms !== undefined ? `${check.last_result.latency_ms} ms` : '—'}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{check.last_result?.checked_at
|
||||
|
||||
@ -4,8 +4,7 @@ import {
|
||||
Paper, Table, TableBody, TableCell, TableContainer, TableHead,
|
||||
TableRow, TextField, Toolbar, Tooltip, Typography,
|
||||
} from '@mui/material'
|
||||
import { Add as AddIcon, Refresh as RefreshIcon, Delete as DeleteIcon } from '@mui/icons-material'
|
||||
import { CheckCircle as CheckCircleIcon, Cancel as CancelIcon, Remove as RemoveIcon } from '@mui/icons-material'
|
||||
import { Add as AddIcon, Refresh as RefreshIcon, Delete as DeleteIcon, CheckCircle as CheckCircleIcon, Cancel as CancelIcon, Remove as RemoveIcon } from '@mui/icons-material'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { apiClient, hostsApi } from '../api/client'
|
||||
import type { Host, HostHealthStatus } from '../types'
|
||||
|
||||
@ -24,8 +24,7 @@ import {
|
||||
Typography,
|
||||
Tooltip,
|
||||
} from '@mui/material'
|
||||
import { Search as SearchIcon } from '@mui/icons-material'
|
||||
import { CheckCircle as CheckCircleIcon, Cancel as CancelIcon, Remove as RemoveIcon } from '@mui/icons-material'
|
||||
import { Search as SearchIcon, CheckCircle as CheckCircleIcon, Cancel as CancelIcon, Remove as RemoveIcon } from '@mui/icons-material'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { hostsApi, jobsApi } from '../api/client'
|
||||
import type { Host, HostHealthStatus } from '../types'
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
# =============================================================================
|
||||
# Linux Patch Manager — Pre-Commit Hook
|
||||
# =============================================================================
|
||||
# Auto-formats Rust code and runs frontend type check before each commit.
|
||||
# Prevents CI format-check failures by ensuring code is always formatted.
|
||||
# Auto-formats Rust code and runs frontend checks before each commit.
|
||||
# Prevents CI format-check and lint failures by catching issues locally.
|
||||
# Install: ./scripts/git-hooks/install.sh
|
||||
# =============================================================================
|
||||
|
||||
@ -16,17 +16,20 @@ if [[ -f "${REPO_ROOT}/Cargo.toml" ]]; then
|
||||
echo "[pre-commit] Running cargo fmt --all ..."
|
||||
cargo fmt --all --manifest-path "${REPO_ROOT}/Cargo.toml" 2>/dev/null
|
||||
|
||||
# Re-stage any files that cargo fmt reformatted (including previously unstaged)
|
||||
# Re-stage any files that cargo fmt reformatted
|
||||
STAGED_RS=$(git diff --name-only --diff-filter=ACM -- '*.rs')
|
||||
if [[ -n "${STAGED_RS}" ]]; then
|
||||
git add ${STAGED_RS}
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── Frontend type check ─────────────────────────────────────────────────────
|
||||
# ── Frontend checks ──────────────────────────────────────────────────────────
|
||||
if [[ -f "${REPO_ROOT}/frontend/package.json" ]]; then
|
||||
echo "[pre-commit] Running TypeScript type check ..."
|
||||
echo "[pre-commit] Running ESLint ..."
|
||||
cd "${REPO_ROOT}/frontend"
|
||||
npx eslint src/ --ext .ts,.tsx --max-warnings 0 2>/dev/null
|
||||
|
||||
echo "[pre-commit] Running TypeScript type check ..."
|
||||
npx tsc --noEmit 2>/dev/null
|
||||
fi
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# =============================================================================
|
||||
# Linux Patch Manager — Pre-Push Hook
|
||||
# =============================================================================
|
||||
# Safety net: verifies cargo fmt and frontend build pass before pushing.
|
||||
# Safety net: verifies cargo fmt, ESLint, and TypeScript pass before pushing.
|
||||
# Install: ./scripts/git-hooks/install.sh
|
||||
# =============================================================================
|
||||
|
||||
@ -20,6 +20,15 @@ if [[ -f "${REPO_ROOT}/Cargo.toml" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── Frontend ESLint ──────────────────────────────────────────────────────────
|
||||
if [[ -f "${REPO_ROOT}/frontend/package.json" ]]; then
|
||||
echo "[pre-push] Running ESLint ..."
|
||||
if ! (cd "${REPO_ROOT}/frontend" && npx eslint src/ --ext .ts,.tsx --max-warnings 0 2>/dev/null); then
|
||||
echo "[pre-push] ❌ ESLint check FAILED."
|
||||
FAILED=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── Frontend type check ─────────────────────────────────────────────────────
|
||||
if [[ -f "${REPO_ROOT}/frontend/package.json" ]]; then
|
||||
echo "[pre-push] Checking TypeScript types ..."
|
||||
|
||||
Reference in New Issue
Block a user