-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add --show-errors flag to show detailed compiler errors #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Moves CLI argument parsing logic into src/args.mts with unit tests. Prepares for adding new flags without complicating index.mts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds a --show-errors flag that works with --check-files to display exact violation reasons and line numbers instead of just counts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The --show-errors flag was parsed but only used with --check-files. Now it works with all commands: default check-all, --overwrite, and --stage-record-file. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Group tests into describe blocks by flag category for better readability: - no flag (default check-all) - --check-files - --overwrite - --stage-record-file Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR successfully implements the --show-errors flag, including robust argument parsing and integration with the React Compiler logger. The changes are well-tested and preserve existing default behaviors.
| } else if (event.kind === 'CompileSkip') { | ||
| reason = event.reason | ||
| } else { | ||
| reason = String(event.data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P3] String(event.data) may result in [object Object] if PipelineError carries an object payload. Consider checking if event.data is an Error instance to use its .message, or using JSON.stringify for generic objects, to ensure the detailed error message is actionable.
When React Compiler errors increase, the current output only shows counts like
src/bad-hook.ts: +3. This makes it hard to know what actually broke. The new--show-errorsflag displays the exact violation messages and line numbers:Test plan
Test locally by running against the sample project fixtures:
npm run build cd src/__fixtures__/sample-projectWithout
--show-errors(baseline behavior) — shows only error countsWith
--show-errors— includes detailed error messagesMultiple files — shows errors from all files
Files with no errors — no detailed errors section shown
Flag position flexibility —
--show-errorsworks anywhere in the commandSimilarly,
--show-errorscan be used together with other flags like--overwrite,--stage-record-file, or when no mode flag is set