Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -706,10 +706,18 @@ function tryCompileFunction(
fn,
);
if (suppressionsInFunction.length > 0) {
return {
kind: 'error',
error: suppressionsToCompilerError(suppressionsInFunction),
};
if (!programContext.opts.noEmit) {
return {
kind: 'error',
error: suppressionsToCompilerError(suppressionsInFunction),
};
}
/* ESLint mode: log suppression but continue analysis */
logError(
suppressionsToCompilerError(suppressionsInFunction),
programContext,
fn.node.loc ?? null,
);
}

try {
Expand Down
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:

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: [],
};