Skip to content

feat: add --show-errors flag to show detailed compiler errors#41

Merged
frankieyan merged 7 commits intomainfrom
frankieyan/check-files-verbose
Jan 28, 2026
Merged

feat: add --show-errors flag to show detailed compiler errors#41
frankieyan merged 7 commits intomainfrom
frankieyan/check-files-verbose

Conversation

@frankieyan
Copy link
Copy Markdown
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
doistbot-app[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
Copy Markdown

@doistbot-app doistbot-app 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.

Comment thread src/index.mts
} else if (event.kind === 'CompileSkip') {
reason = event.reason
} else {
reason = String(event.data)
Copy link
Copy Markdown

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.

@gnapse
Copy link
Copy Markdown

gnapse commented Jan 27, 2026

I did not get to this on time. Please re-roll the dice.

@frankieyan frankieyan requested review from a team and engfragui and removed request for a team and gnapse January 27, 2026 02:32
@engfragui
Copy link
Copy Markdown

engfragui commented Jan 27, 2026

💭 (Out of my curiosity/for my own understanding) @frankieyan Do you plan to use this flag in todoist-web (and other relevant repos) by default, right? It shouldn't be up to the developer to run the command with the new flag, but it should happen by default, correct? 🙏

@engfragui
Copy link
Copy Markdown

engfragui commented Jan 27, 2026

🔍 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.

💭 (Not related to this PR specifically, but I'll note it regardless) It seems to me that, for this specific file, it'd make more sense (ideally) to output the "Cannot access refs during render" error only once (+1) instead of 3 times (since it's the same error, on the same line number, etc.), right?
Not sure how tricky/how worth it it would be, since it's not really a deal-breaker or anything 😅

@engfragui
Copy link
Copy Markdown

💭 I think the code and the unit tests provide enough "self-documentation", so very option to add the --show-errors to the README file.

@frankieyan
Copy link
Copy Markdown
Member Author

Do you plan to use this flag in todoist-web (and other relevant repos) by default, right? It shouldn't be up to the developer to run the command with the new flag, but it should happen by default, correct?

IMO by default (for our pre-commit and CI hooks), we don't need to show the exact errors, but this would be helpful for LLMs when planning what to fix. Despite having the records file and being able to run Babel to extract the exact errors, I found that it goes off on fixes that don't actually target the violations.

I'll update this section of the docs to reference this flag and hopefully we'll have better results.

it'd make more sense (ideally) to output the "Cannot access refs during render" error only once (+1) instead of 3 times (since it's the same error, on the same line number, etc.), right?

That was bugging me a bit too, but wasn't enough for me to fix it. I'll throw this at my robot helper now that we have real user (i.e. you) feedback about this 😁

Thank you for the reminder about the readme too. Slipped my mind but I'll add it now 🙌

frankieyan and others added 3 commits January 28, 2026 11:55
Consolidate duplicate errors by line and reason, displaying a count
suffix (e.g., "x3") instead of repeating the same error multiple times.
Extract formatErrorDetails() helper to reduce code duplication.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
All callers pass this parameter explicitly, so making it required
improves type consistency.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@frankieyan frankieyan merged commit 746591f into main Jan 28, 2026
2 checks passed
@frankieyan frankieyan deleted the frankieyan/check-files-verbose branch January 28, 2026 20:53
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.

3 participants