You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this should be an ESLint rule or a Preflight check (opened upleveled/preflight#193 for the Preflight check), but detecting infinite loops in student code would be really nice, especially when students get into using useEffect in React.
#35 will help with warning about using useEffect without a dependency array, but there are other forms of infinite loops.
One potential candidate for detecting infinite loops would be to detect if the student has an (unconditional) call to setX in a useEffect which also specifies the dependency x. If the student has the setX inside a condition, this would not trigger.
Some other, more general ideas for infinite loop detection:
One potential candidate for detecting infinite loops would be to detect if the student has an
... call to setX in a useEffect which also specifies the dependency x.
Not sure if this should be an ESLint rule or a Preflight check (opened upleveled/preflight#193 for the Preflight check), but detecting infinite loops in student code would be really nice, especially when students get into using
useEffect
in React.#35 will help with warning about using
useEffect
without a dependency array, but there are other forms of infinite loops.One potential candidate for detecting infinite loops would be to detect if the student has an (unconditional) call to
setX
in auseEffect
which also specifies the dependencyx
. If the student has thesetX
inside a condition, this would not trigger.Some other, more general ideas for infinite loop detection:
Potentially helpful for getting a reference to
useEffect
(maybe already implemented in #35):useState
- can use this as a basis for this and also #35 - fromeslint-plugin-react
: https://github.com/yannickcr/eslint-plugin-react/blob/5f49f51dd237dd4c6758bc0c3e5b300a28770966/lib/rules/hook-use-state.jsThe text was updated successfully, but these errors were encountered: