Skip to content

Fix : Compiler eslint suppression silent skip 35105 - #192

Closed
everettbu wants to merge 7 commits into
mainfrom
fix/eslint-suppression-silent-skip-35105
Closed

everettbu wants to merge 7 commits into
mainfrom
fix/eslint-suppression-silent-skip-35105

Conversation

@everettbu

@everettbu everettbu commented Dec 12, 2025

Copy link
Copy Markdown

Mirror of facebook/react#35124
Original author: manNomi


Summary

This PR fixes #35105 where eslint-disable comments cause the React Compiler to skip entire functions, preventing important diagnostics like incompatible-library warnings 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

As is To be
스크린샷 2025-11-13 오전 9 25 18 스크린샷 2025-11-13 오전 9 23 36

|

@greptile-apps

greptile-apps Bot commented Dec 12, 2025

Copy link
Copy Markdown

Greptile Summary

This PR fixes a critical issue where ESLint suppressions caused the React Compiler to silently skip entire functions in ESLint mode, preventing important diagnostics like incompatible-library warnings from being shown.

The implementation correctly modifies tryCompileFunction in Program.ts to distinguish between build mode and ESLint mode (noEmit: true). In ESLint mode, suppressions are now logged as diagnostics but compilation continues to detect other issues. Build mode behavior remains unchanged for backward compatibility.

Key changes:

  • Modified suppression handling in Program.ts:736-749 to check noEmit flag
  • In build mode: returns early with suppression error (existing behavior)
  • In ESLint mode: logs suppression error and continues compilation (new behavior)
  • Added comprehensive test case demonstrating the fix

Issue identified:

  • Test expectation file shows "Found 1 error" but will produce 2 errors in practice (both the suppression error and the incompatible-library error)

Confidence Score: 4/5

  • This PR is safe to merge after fixing the test expectation mismatch
  • The implementation correctly addresses the stated goal of allowing ESLint mode to continue compilation after detecting suppressions. The logic is sound and maintains backward compatibility by only changing behavior when noEmit: true. However, the test expectation needs to be corrected to match the actual behavior (2 errors instead of 1).
  • Pay close attention to error.eslint-mode-detects-incompatible-library-with-suppression.expect.md - the expected output must be updated to reflect 2 errors

Important Files Changed

Filename Overview
compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts implements ESLint mode behavior to log suppressions but continue compilation, allowing detection of other issues like incompatible-library warnings
compiler/packages/babel-plugin-react-compiler/src/tests/fixtures/compiler/error.eslint-mode-detects-incompatible-library-with-suppression.js test fixture demonstrating that ESLint mode detects incompatible-library errors even when eslint suppressions are present
compiler/packages/babel-plugin-react-compiler/src/tests/fixtures/compiler/error.eslint-mode-detects-incompatible-library-with-suppression.expect.md expected test output shows only 1 error, but the implementation will produce 2 errors (suppression + incompatible-library)

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

## Error

```
Found 1 error:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

## Error

```
Found 1 error:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Suggested change
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.

@github-actions

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added the Resolution: Stale Automatically closed due to inactivity label Apr 19, 2026
@github-actions

Copy link
Copy Markdown

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!

@github-actions github-actions Bot closed this Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Resolution: Stale Automatically closed due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants