Skip to content

Conversation

@frankieyan
Copy link
Member

@frankieyan frankieyan commented Jan 24, 2026

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-errors flag displays the exact violation messages and line numbers:

❌ React Compiler errors have increased in:
  • src/bad-hook.ts: +3

Detailed errors:
    - src/bad-hook.ts: Line 6: Cannot access refs during render

Test plan

Test locally by running against the sample project fixtures:

npm run build
cd src/__fixtures__/sample-project
  • Without --show-errors (baseline behavior) — shows only error counts

    node ../../../dist/index.mjs --check-files src/bad-hook.ts
    🔍 Checking 1 file for React Compiler errors…
    ❌ React Compiler errors have increased in:
      • src/bad-hook.ts: +3
    
    Please fix the errors and run the command again.
    
  • With --show-errors — includes detailed error messages

    node ../../../dist/index.mjs --check-files --show-errors src/bad-hook.ts
    🔍 Checking 1 file for React Compiler errors…
    ❌ React Compiler errors have increased in:
      • src/bad-hook.ts: +3
    
    Detailed errors:
        - src/bad-hook.ts: Line 6: Cannot access refs during render
        - src/bad-hook.ts: Line 6: Cannot access refs during render
        - src/bad-hook.ts: Line 6: Cannot access refs during render
    
    Please fix the errors and run the command again.
    
  • Multiple files — shows errors from all files

    node ../../../dist/index.mjs --check-files --show-errors src/bad-hook.ts src/bad-component.tsx
    🔍 Checking 2 files for React Compiler errors…
    ❌ React Compiler errors have increased in:
      • src/bad-hook.ts: +3
      • src/bad-component.tsx: +1
    
    Detailed errors:
        - src/bad-hook.ts: Line 6: Cannot access refs during render
        - src/bad-hook.ts: Line 6: Cannot access refs during render
        - src/bad-hook.ts: Line 6: Cannot access refs during render
        - src/bad-component.tsx: Line 6: Hooks must always be called in a consistent order...
    
    Please fix the errors and run the command again.
    
  • Files with no errors — no detailed errors section shown

    node ../../../dist/index.mjs --check-files --show-errors src/good-component.tsx
    🔍 Checking 1 file for React Compiler errors…
    ✅ No new React Compiler errors in checked files
    
  • Flag position flexibility--show-errors works anywhere in the command

    node ../../../dist/index.mjs --show-errors --check-files src/bad-hook.ts
    node ../../../dist/index.mjs --check-files --show-errors src/bad-hook.ts
    node ../../../dist/index.mjs --check-files src/bad-hook.ts --show-errors
  • Similarly, --show-errors can be used together with other flags like --overwrite, --stage-record-file, or when no mode flag is set

frankieyan and others added 2 commits January 24, 2026 10:33
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>
@frankieyan frankieyan requested a review from a team as a code owner January 24, 2026 22:25
@frankieyan frankieyan requested review from gnapse and removed request for a team January 24, 2026 22:25
doist-bot[bot]

This comment was marked as outdated.

@frankieyan frankieyan marked this pull request as draft January 24, 2026 22:51
frankieyan and others added 2 commits January 24, 2026 14:59
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>
@frankieyan frankieyan marked this pull request as ready for review January 25, 2026 03:00
@frankieyan frankieyan added the 👀 Show PR PR must be reviewed before or after merging label Jan 25, 2026
Copy link

@doist-bot doist-bot bot left a 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)
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

👀 Show PR PR must be reviewed before or after merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants