Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions packages/react-doctor/src/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,13 @@ const printDiagnostics = (diagnostics: Diagnostic[], isVerbose: boolean): void =
const fileLines = buildFileLineMap(ruleDiagnostics);

for (const [filePath, lines] of fileLines) {
const lineLabel = lines.length > 0 ? `: ${lines.join(", ")}` : "";
logger.dim(` ${filePath}${lineLabel}`);
if (lines.length > 0) {
for (const line of lines) {
logger.dim(` ${filePath}:${line}`);
}
} else {
logger.dim(` ${filePath}`);
}
}
}

Expand Down Expand Up @@ -137,8 +142,13 @@ const formatRuleSummary = (ruleKey: string, ruleDiagnostics: Diagnostic[]): stri

sections.push("", "Files:");
for (const [filePath, lines] of fileLines) {
const lineLabel = lines.length > 0 ? `: ${lines.join(", ")}` : "";
sections.push(` ${filePath}${lineLabel}`);
if (lines.length > 0) {
for (const line of lines) {
sections.push(` ${filePath}:${line}`);
}
} else {
sections.push(` ${filePath}`);
}
}

return sections.join("\n") + "\n";
Expand Down