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
Is your feature request related to a problem? Please describe.
A single useEffect can be easy to understand. However, multiple useEffect calls in a relatively complex application can be hard to understand.
Describe the solution you'd like
I propose a rule vtex/react-explicit-effects, or vtex/react-documented-effects, that looks for effect react hooks (not only useEffect) and enforces one of two ways to document the purpose of the hook:
Adding a comment above the hook call, explaining the effect use-case.
import{useEffect}from'react'constPotato=()=>{// do this and do thatuseEffect(()=>{/// ...})}
Using a named function instead of an arrow function:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
You can add the fresh label to prevent me from taking any action.
If this is a discussion thread, the most voted option will be final. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
You can add the fresh label to prevent me from taking any action.
If this is a discussion thread, the most voted option will be final. Thank you for your contributions.
Is your feature request related to a problem? Please describe.
A single
useEffect
can be easy to understand. However, multipleuseEffect
calls in a relatively complex application can be hard to understand.Describe the solution you'd like
I propose a rule
vtex/react-explicit-effects
, orvtex/react-documented-effects
, that looks for effect react hooks (not onlyuseEffect
) and enforces one of two ways to document the purpose of the hook:Describe alternatives you've considered
Leave people to document effects themselves (which is a big no-no)
The text was updated successfully, but these errors were encountered: