Conversation
Greptile SummaryThis PR fixes a critical issue where ESLint suppressions caused the React Compiler to silently skip entire functions in ESLint mode, preventing important diagnostics like The implementation correctly modifies Key changes:
Issue identified:
Confidence Score: 4/5
Important Files Changed
|
| ## Error | ||
|
|
||
| ``` | ||
| Found 1 error: |
There was a problem hiding this comment.
[P1] Test expectation shows "Found 1 error" but the implementation will produce 2 errors. The eslint suppression on line 9 of the test file (react-hooks/exhaustive-deps) is in DEFAULT_ESLINT_SUPPRESSIONS and will be detected. In ESLint mode, the code logs this suppression error (Program.ts:744-748) then continues compilation, which throws an incompatible-library error that also gets logged (Program.ts:647 via handleError). The expected output should state "Found 2 errors:" and include both the suppression error and the incompatible-library error.
Prompt To Fix With AI
This is a comment left during a code review.
Path: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.eslint-mode-detects-incompatible-library-with-suppression.expect.md
Line: 30:30
Comment:
[P1] Test expectation shows "Found 1 error" but the implementation will produce 2 errors. The eslint suppression on line 9 of the test file (`react-hooks/exhaustive-deps`) is in DEFAULT_ESLINT_SUPPRESSIONS and will be detected. In ESLint mode, the code logs this suppression error (Program.ts:744-748) then continues compilation, which throws an incompatible-library error that also gets logged (Program.ts:647 via handleError). The expected output should state "Found 2 errors:" and include both the suppression error and the incompatible-library error.
How can I resolve this? If you propose a fix, please make it concise.| ## Error | ||
|
|
||
| ``` | ||
| Found 1 error: |
There was a problem hiding this comment.
syntax: expected output says "Found 1 error" but the implementation produces 2 errors: the react-hooks/exhaustive-deps suppression on line 9 is in DEFAULT_ESLINT_SUPPRESSIONS (Program.ts:338), so in ESLint mode it logs this suppression error (Program.ts:744-748), then continues compilation which throws the incompatible-library error that also gets logged (Program.ts:647). the output should state "Found 2 errors:" and include both errors
| Found 1 error: | |
| Found 2 errors: |
Prompt To Fix With AI
This is a comment left during a code review.
Path: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.eslint-mode-detects-incompatible-library-with-suppression.expect.md
Line: 30:30
Comment:
**syntax:** expected output says "Found 1 error" but the implementation produces 2 errors: the `react-hooks/exhaustive-deps` suppression on line 9 is in DEFAULT_ESLINT_SUPPRESSIONS (Program.ts:338), so in ESLint mode it logs this suppression error (Program.ts:744-748), then continues compilation which throws the incompatible-library error that also gets logged (Program.ts:647). the output should state "Found 2 errors:" and include both errors
```suggestion
Found 2 errors:
```
How can I resolve this? If you propose a fix, please make it concise.|
This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated. |
|
Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you! |
Mirror of facebook/react#35124
Original author: manNomi
Summary
This PR fixes #35105 where
eslint-disablecomments cause the React Compiler to skip entire functions, preventing important diagnostics likeincompatible-librarywarnings from being shown.Motivation: When developers add unrelated ESLint suppressions (e.g., for
exhaustive-deps), the compiler would silently skip analyzing the entire function. This meant critical warnings about incompatible APIs would never reach the developer, leading to silent performance issues in production.Solution: Implemented the "shorter term fix" suggested by
@josephsavona- in ESLint mode (noEmit: true), suppressions are now logged as diagnostics but compilation continues to detect other issues. Build mode behavior is unchanged for backward compatibility.Real-World Testing
|