Is it possible to enforce a specific order in which React hooks are used? For example some linting/prettier settings that will always make sure to first use 'useState' hooks and only after that use 'useEffect' hooks. Let's say I have the following code:
const MyComponent = () => {
const [myState1, setMyState1] = React.useState();
const [myState2, setMyState2] = React.useState();
React.useEffect(() => {
runSomeEffect()
}, [])
const [myState3, setMyState3] = React.useState();
return <div>...</div>
}
I would like to have some sort of warning that the third useState hooks should be moved to the top. I looked into Eslint and Prettier, but I don't think any of those have rules to enforce the order of React hooks.