-
Notifications
You must be signed in to change notification settings - Fork 0
Fix : Compiler eslint suppression silent skip 35105 #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
a9c1fa7
aaa60c1
6a3262a
a1e031d
4423c3c
19159ee
bc24011
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,46 @@ | ||||||
|
|
||||||
| ## Input | ||||||
|
|
||||||
| ```javascript | ||||||
| // @noEmit | ||||||
| import {useEffect} from 'react'; | ||||||
| import {useKnownIncompatible} from 'ReactCompilerKnownIncompatibleTest'; | ||||||
|
|
||||||
| function MyHook() { | ||||||
| const data = useKnownIncompatible(); | ||||||
|
|
||||||
| useEffect(() => { | ||||||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||||||
| }, []); | ||||||
|
|
||||||
| return data; | ||||||
| } | ||||||
|
|
||||||
| export const FIXTURE_ENTRYPOINT = { | ||||||
| fn: MyHook, | ||||||
| params: [], | ||||||
| }; | ||||||
|
|
||||||
| ``` | ||||||
|
|
||||||
|
|
||||||
| ## Error | ||||||
|
|
||||||
| ``` | ||||||
| Found 1 error: | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Suggested change
Prompt To Fix With AIThis 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. |
||||||
|
|
||||||
| Compilation Skipped: Use of incompatible library | ||||||
|
|
||||||
| This API returns functions which cannot be memoized without leading to stale UI. To prevent this, by default React Compiler will skip memoizing this component/hook. However, you may see issues if values from this API are passed to other components/hooks that are memoized. | ||||||
|
|
||||||
| error.eslint-mode-detects-incompatible-library-with-suppression.ts:6:15 | ||||||
| 4 | | ||||||
| 5 | function MyHook() { | ||||||
| > 6 | const data = useKnownIncompatible(); | ||||||
| | ^^^^^^^^^^^^^^^^^^^^ useKnownIncompatible is known to be incompatible | ||||||
| 7 | | ||||||
| 8 | useEffect(() => { | ||||||
| 9 | // eslint-disable-next-line react-hooks/exhaustive-deps | ||||||
| ``` | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // @noEmit | ||
| import {useEffect} from 'react'; | ||
| import {useKnownIncompatible} from 'ReactCompilerKnownIncompatibleTest'; | ||
|
|
||
| function MyHook() { | ||
| const data = useKnownIncompatible(); | ||
|
|
||
| useEffect(() => { | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, []); | ||
|
|
||
| return data; | ||
| } | ||
|
|
||
| export const FIXTURE_ENTRYPOINT = { | ||
| fn: MyHook, | ||
| params: [], | ||
| }; |
There was a problem hiding this comment.
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