package main import "fmt" func init() { register(Check{ Seq: 70, ID: "7", Title: "No useState for tab state in routes (use URL ?tab= params)", Run: func(ctx *ScanContext, rep *Reporter) { // Check 7: No useState for tab state in route files fmt.Println("=== Check 7: No useState for tab state in routes (use URL ?tab= params) ===") if len(ctx.frontendTargets) > 0 { var tabViolations []tabStateViolation for _, target := range ctx.frontendTargets { for _, v := range checkTabState(target.dir) { v.file = prefixDisplayPath(target.label, v.file) tabViolations = append(tabViolations, v) } } if len(tabViolations) > 0 { fmt.Printf(" FAIL: %d route file(s) use useState for tab state:\n", len(tabViolations)) for _, v := range tabViolations { fmt.Printf(" %s:%d %s\n", v.file, v.line, v.snippet) } fmt.Println("\n Fix: Use URL search params (?tab=) for bookmarkability. See settings.tsx for reference.") rep.Fail() } else { fmt.Println(" OK: No useState tab state in routes") printPerTargetOKLines(frontendTargetLabels(ctx.frontendTargets)) } } else { fmt.Println(" SKIP: no frontend sources found") } fmt.Println() }, }) }