feat: report error decreases in --check-files flag#36
Conversation
There was a problem hiding this comment.
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).
--check-files flag
1876c23 to
f3838b0
Compare
f3838b0 to
3add358
Compare
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>
3add358 to
7824630
Compare
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>
7824630 to
bb98caa
Compare
There was a problem hiding this comment.
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.
Summary
When you fix React Compiler errors, it's nice to know your fixes actually worked. Right now, the
--check-filesflag 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:
Fixes #35
Test plan
cd src/__fixtures__/sample-project node ../../../dist/index.mjs --overwrite.react-compiler.rec.jsonis added withbad-component.tsandbad-hook.tsTest decreases:
bad-hook.tsviolations by removing all ref accessTest increases:
good-hook.tsby running one of the hooks conditionally