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