diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-non-exhaustive-effect-deps.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-non-exhaustive-effect-deps.expect.md new file mode 100644 index 000000000000..ccf277d30dee --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-non-exhaustive-effect-deps.expect.md @@ -0,0 +1,36 @@ + +## Input + +```javascript +import {logValue} from 'shared-runtime'; + +function Component({a}) { + useEffect(() => { + logValue(a); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + return null; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{a: 0}], + sequentialRenders: [{a: 1}], +}; + +``` + + +## Error + +``` + 4 | useEffect(() => { + 5 | logValue(a); +> 6 | // eslint-disable-next-line react-hooks/exhaustive-deps + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: React Compiler has skipped optimizing this component because one or more React ESLint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in unexpected or incorrect behavior. eslint-disable-next-line react-hooks/exhaustive-deps (6:6) + 7 | }, []); + 8 | return null; + 9 | } +``` + + \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-non-exhaustive-effect-deps.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-non-exhaustive-effect-deps.js new file mode 100644 index 000000000000..ff1f271fa3de --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-non-exhaustive-effect-deps.js @@ -0,0 +1,15 @@ +import {logValue} from 'shared-runtime'; + +function Component({a}) { + useEffect(() => { + logValue(a); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + return null; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{a: 0}], + sequentialRenders: [{a: 1}], +};