[compiler] Add --verbose flag to react-compiler-healthcheck#538
[compiler] Add --verbose flag to react-compiler-healthcheck#538everettbu wants to merge 1 commit into
Conversation
When --verbose (-v) is passed, the healthcheck CLI now prints per-component failure details (file path, line/column, and error reason) grouped into actionable and other failures, in addition to the existing summary line.
Greptile SummaryThis PR adds a
Confidence Score: 3/5
Important Files Changed
Last reviewed commit: 4dff802 |
| for (const e of events) { | ||
| if (e.filename != null && e.fnLoc != null) { | ||
| const key = `${e.filename}:${e.fnLoc.start.line}:${e.fnLoc.start.column}`; | ||
| if (!seen.has(key)) { | ||
| seen.set(key, e); | ||
| } |
There was a problem hiding this comment.
Deduplication key inconsistency with countUniqueLocInEvents
The deduplication key here uses e.fnLoc.start.line and e.fnLoc.start.column, while the existing countUniqueLocInEvents (line 126) uses ${e.fnLoc.start}:${e.fnLoc.end}. Since fnLoc.start is an object ({line, column}), the existing function's key stringifies to filename:[object Object]:[object Object], which effectively deduplicates by filename only.
This means the count shown in the summary line (e.g., "5 out of 10 components") could disagree with the number of items printed in verbose mode, since verbose correctly deduplicates by filename:line:column. This pre-existing bug in countUniqueLocInEvents isn't introduced by this PR, but combining it with the new verbose output will make the discrepancy visible to users.
Consider aligning the dedup logic—either fix countUniqueLocInEvents to use .start.line/.start.column/.end.line/.end.column, or extract a shared helper for building dedup keys.
Prompt To Fix With AI
This is a comment left during a code review.
Path: compiler/packages/react-compiler-healthcheck/src/checks/reactCompiler.ts
Line: 159-164
Comment:
**Deduplication key inconsistency with `countUniqueLocInEvents`**
The deduplication key here uses `e.fnLoc.start.line` and `e.fnLoc.start.column`, while the existing `countUniqueLocInEvents` (line 126) uses `${e.fnLoc.start}:${e.fnLoc.end}`. Since `fnLoc.start` is an object (`{line, column}`), the existing function's key stringifies to `filename:[object Object]:[object Object]`, which effectively deduplicates by filename only.
This means the count shown in the summary line (e.g., "5 out of 10 components") could disagree with the number of items printed in verbose mode, since verbose correctly deduplicates by `filename:line:column`. This pre-existing bug in `countUniqueLocInEvents` isn't introduced by this PR, but combining it with the new verbose output will make the discrepancy visible to users.
Consider aligning the dedup logic—either fix `countUniqueLocInEvents` to use `.start.line`/`.start.column`/`.end.line`/`.end.column`, or extract a shared helper for building dedup keys.
How can I resolve this? If you propose a fix, please make it concise.|
Upstream PR was closed or merged. Code is synced via branch mirror. |
Mirror of facebook/react#35812
Original author: apoorvdarshan
Summary
--verbose(-v) CLI flag toreact-compiler-healthcheckTest plan
npx tsupincompiler/packages/react-compiler-healthcheck--verboseand confirm output is unchanged (summary only)--verboseand confirm failure details are printed with file paths, locations, and reasons-valias and confirm it behaves the same as--verbose