[compiler] Surface all lint diagnostics instead of stopping at first validation error#575
[compiler] Surface all lint diagnostics instead of stopping at first validation error#575everettbu wants to merge 1 commit into
Conversation
…validation error In lint mode (ESLint plugin), the compilation pipeline would stop at the first validation error. For example, if `validateHooksUsage` found an issue, subsequent validations like `validateNoCapitalizedCalls` would never run, hiding additional lint errors from the user. This changes the pipeline to use `env.logErrors()` instead of `.unwrap()` for early validations (hooks usage and capitalized calls) when in lint mode. These validations are purely diagnostic — they don't modify the HIR — so it's safe to continue the pipeline after logging their errors. This fixes the issue where files with multiple types of lint violations would only show the first category of error. Fixes #35394 Fixes #31545
Greptile SummaryThis PR fixes the React Compiler ESLint plugin to surface all lint diagnostics from a function instead of stopping at the first validation error. Previously,
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: aac8052 |
|
Upstream PR was closed or merged. Code is synced via branch mirror. |
Mirror of facebook/react#35857
Original author: sleitor
Summary
In lint mode (ESLint plugin), the compilation pipeline stops at the first validation error. For example, if
validateHooksUsagefinds an issue, subsequent validations likevalidateNoCapitalizedCallsnever run, hiding additional lint errors from the user.This PR changes the pipeline to use
env.logErrors()instead of.unwrap()for early validations (hooks usage and capitalized calls) when in lint mode. These validations are purely diagnostic — they don't modify the HIR — so it's safe to continue the pipeline after logging their errors.Before
A file with both a hooks violation and a capitalized-calls violation would only show the hooks error.
After
Both errors are surfaced to the user.
How did you test this change?
Repro35394-test.tsthat reproduces the issue from #35394PluginTest-test.tsto verify the newly surfaced diagnostics (the existing TODO comment 'actually return multiple diagnostics in this case' is now resolved)Fixes #35394
Fixes #31545