package main import ( "fmt" "os" "strings" ) func init() { register(Check{ Seq: 40, ID: "4", Title: "Frontend auto-format, lint, and typecheck", Run: func(ctx *ScanContext, rep *Reporter) { // Check 4: Frontend auto-fix, lint, and typecheck fmt.Println("=== Check 4: Frontend auto-format, lint, and typecheck ===") if len(ctx.frontendTargets) > 0 { completedTargets, skippedTargets, lintFailures, lintErr := runFrontendAutoFixAndLint(ctx.repoRoot, ctx.frontendTargets) if lintErr != nil { fmt.Printf(" ERROR: failed to run frontend lint pipeline: %v\n", lintErr) os.Exit(2) } for _, skipped := range skippedTargets { fmt.Printf(" SKIP: %s\n", skipped) } if len(lintFailures) > 0 { fmt.Printf(" FAIL: %d frontend target(s) failed Prettier, ESLint, or TypeScript checks:\n", len(lintFailures)) for _, failure := range lintFailures { fmt.Printf(" [%s] %s\n", failure.stage, failure.target) if failure.output != "" { for line := range strings.SplitSeq(failure.output, "\n") { fmt.Printf(" %s\n", line) } } } rep.Fail() } else if len(completedTargets) > 0 { fmt.Printf(" OK: Prettier, ESLint, and TypeScript checks clean for %d frontend target(s)\n", len(completedTargets)) for _, target := range completedTargets { fmt.Printf(" - %s\n", target) } } else { fmt.Println(" SKIP: no frontend lint targets with ESLint config") } } else { fmt.Println(" SKIP: no frontend sources found") } fmt.Println() }, }) }