package main import "fmt" func init() { register(Check{ Seq: 80, ID: "8", Title: "Import @block-ninja/api from subpaths only", Run: func(ctx *ScanContext, rep *Reporter) { // Check 8: Import @block-ninja/api from subpaths only fmt.Println("=== Check 8: Import @block-ninja/api from subpaths only ===") if len(ctx.frontendTargets) > 0 { var bareImports []bareImportViolation for _, target := range ctx.frontendTargets { for _, v := range checkBareImports(target.dir) { v.file = prefixDisplayPath(target.label, v.file) bareImports = append(bareImports, v) } } if len(bareImports) > 0 { fmt.Printf(" FAIL: %d bare import(s) from '@block-ninja/api' (naming conflicts):\n", len(bareImports)) for _, v := range bareImports { fmt.Printf(" %s:%d %s\n", v.file, v.line, v.snippet) } fmt.Println("\n Fix: Import from subpaths: @block-ninja/api/types, /queries, or /services") rep.Fail() } else { fmt.Println(" OK: All @block-ninja/api imports use subpaths") printPerTargetOKLines(frontendTargetLabels(ctx.frontendTargets)) } } else { fmt.Println(" SKIP: no frontend sources found") } fmt.Println() }, }) }