Closed
Description
Describe the bug
When placing the set
function inside of an IIFE (Immediately Invoked Function Expression) inside of other hooks, the plugin misidentifies the set
function as it is inside of useEffect
, useLayoutEffect
, and triggers rules hooks-extra-no-direct-set-state-in-use-effect
, hooks-extra-no-direct-set-state-in-use-layout-effect
Reproduction
const test = useCallback(() => {
setSomething('') // doesn't trigger the rules
;(() => {
setSomething('') // trigger the rules
})()
}, [])
Expected behavior
Not trigger hooks-extra-no-direct-set-state-in-use-effect
, hooks-extra-no-direct-set-state-in-use-layout-effect
Platform and versions
React v19.0.0
@eslint-react/eslint-plugin v1.30.1
Stack trace
Additional context
No response