-
Notifications
You must be signed in to change notification settings - Fork 170
Open
Description
I run a fairy strict eslint setup on any code that is being committed:
rules: {
...reactHooks.configs['recommended-latest'].rules,
// https://github.com/facebook/react/blob/3640f38/compiler/packages/babel-plugin-react-compiler/src/CompilerError.ts#L807-L1111
'react-hooks/todo': 'error',
// other useful rules:
'react-hooks/capitalized-calls': 'error',
'react-hooks/hooks': 'error',
'react-hooks/rule-suppression': 'error',
'react-hooks/syntax': 'error',
'react-hooks/unsupported-syntax': 'error',
}
Still, code like this goes through without complaints.
const [image, setImage] = useState(initImage);
useEffect(() => {
setImage(initImage);
}, [initImage]);
When I run the React Doctor however, it points out that this should be derived during render instead.
Perfectly valid to highlight this, but curious how this is being detected by the Doctor when the Compiler doesn't complain?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels