-
-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Describe the problem
A rule for detecting unnecessary useEffect(s) hooks, the successor of react-hooks-extra/no-direct-set-state-in-use-effect inspired by NickvanDyke/eslint-plugin-react-you-might-not-need-an-effect, differs in that the granularity of the error message of the new rule is precisely aligned with each scenario described in https://react.dev/learn/you-might-not-need-an-effect.
Describe the solution you'd like
No response
Alternatives considered
Update the react-hooks-extra/no-direct-set-state-in-use-effect rule to adapt to the new behavior.
Not adopted because the new enforce scope and error messages do not fully compatible with the scope indicated by the rule name. It is a better choice to keep the rule's current behavior and continue focusing on flagging setState, which also enables it to capture more edge cases in this specific scenario. We have already implemented the capture of some very marginal scenarios under this rule.
Additional context
We used the name no-unnecessary-use-effect because we already have a naming convention similar to no-unnecessary-use-memo and no-unnecessary-use-callback
Here are no plans to deprecate react-hooks-extra/no-direct-set-state-in-use-effect. It will continue to be updated and maintained, but the focus will be on setState.