Skip to content

feat: report error decreases in --check-files flag#36

Merged
frankieyan merged 6 commits intomainfrom
frankieyan/report-error-decreases
Jan 22, 2026
Merged

feat: report error decreases in --check-files flag#36
frankieyan merged 6 commits intomainfrom
frankieyan/report-error-decreases

Conversation

@frankieyan
Copy link
Copy Markdown
Member

@frankieyan frankieyan commented Jan 21, 2026

Summary

When you fix React Compiler errors, it's nice to know your fixes actually worked. Right now, the --check-files flag only tells you when things get worse (error counts go up), but stays silent when things get better.

This PR updates the check to also report when error counts decrease. So if you fix a few errors and run the check, you'll see a message like:

🎉 React Compiler errors have decreased in:
  • src/MyComponent.tsx: -3

Fixes #35

Test plan

  • Build the project and test against the sample fixtures:
     npm run build
  • Create a baseline with the bad fixtures
     cd src/__fixtures__/sample-project
     node ../../../dist/index.mjs --overwrite
  • A .react-compiler.rec.json is added with bad-component.ts and bad-hook.ts

Test decreases:

  • Fix the bad-hook.ts violations by removing all ref access
  • Run check-files:
     node ../../../dist/index.mjs --check-files src/bad-hook.ts
  • You should see the decrease message for any files that previously had errors recorded.

Test increases:

  • Introduce an error in good-hook.ts by running one of the hooks conditionally
  • Run check-files:
     node ../../../dist/index.mjs --check-files src/good-hook.ts
  • Should still exit with error when errors increase.

@frankieyan frankieyan requested a review from a team as a code owner January 21, 2026 19:33
@frankieyan frankieyan requested review from Bloomca and removed request for a team January 21, 2026 19:33
@frankieyan frankieyan added the 👀 Show PR PR must be reviewed before or after merging label Jan 21, 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.

This PR successfully implements reporting for error decreases and handles deleted files in records. The logic for calculating changes looks correct. I have a few suggestions to align the implementation with the updated README (file validation) and improve the user experience (reporting order and redundant logs).

Comment thread src/index.mts Outdated
Comment thread src/index.mts
Comment thread src/index.mts
@frankieyan frankieyan changed the base branch from main to frankieyan/pluralize-helper January 21, 2026 19:35
@frankieyan frankieyan marked this pull request as draft January 21, 2026 19:40
@frankieyan frankieyan changed the title feat: report error decreases in --check-files flag feat: report error decreases in --check-files flag Jan 22, 2026
@frankieyan frankieyan force-pushed the frankieyan/report-error-decreases branch from 1876c23 to f3838b0 Compare January 22, 2026 05:34
Base automatically changed from frankieyan/pluralize-helper to main January 22, 2026 05:45
@frankieyan frankieyan force-pushed the frankieyan/report-error-decreases branch from f3838b0 to 3add358 Compare January 22, 2026 05:51
frankieyan and others added 3 commits January 21, 2026 21:52
Replace getErrorIncreases with getErrorChanges to track both increases
and decreases. When errors decrease, display an informational message
to help developers verify fixes have succeeded.

Closes #35

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move the decrease reporting block before the increase check in
checkErrorChanges(). Previously, if there were any error increases,
exitWithError() would terminate the process immediately, preventing
users from seeing their successful fixes (decreases).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@frankieyan frankieyan force-pushed the frankieyan/report-error-decreases branch from 3add358 to 7824630 Compare January 22, 2026 05:53
frankieyan and others added 3 commits January 21, 2026 22:03
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace reduce pattern with a cleaner for...of loop since we're just
building up a mutable object.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@frankieyan frankieyan force-pushed the frankieyan/report-error-decreases branch from 7824630 to bb98caa Compare January 22, 2026 06:04
@frankieyan frankieyan marked this pull request as ready for review January 22, 2026 06:05
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 feature to report error decreases is a great addition for visibility. However, there are two critical issues that need to be addressed to ensure the code functions correctly: checkErrorChanges needs to return the records object for its caller, and the definition of newErrorCount appears to be missing in getErrorChanges, which would cause a runtime error.

Comment thread src/index.mts
Comment thread src/records-file.mts
@frankieyan frankieyan merged commit 7f18758 into main Jan 22, 2026
2 checks passed
@frankieyan frankieyan deleted the frankieyan/report-error-decreases branch January 22, 2026 06:11
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.

--check-files should report when errors have decreased

1 participant