Handle react version detect errors #2336
Merged
+14
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this fix
The fix to #2276 (commit golopot@e2e246a) caused a regression only for scenarios where react version cannot be detected. Once the first warning is logged, a second try always results in the raw error being thrown and failure of the lint process.
Solution
The
warnedForMissingVersion
flag should only control the warning message and not the handling of the error (which was the previous behavior)I have included a test that ensures only a single error is present in stack. The issue can be reproduced by going back to the test commit. Here is the output for the case when it fails (i.e. before this fix):