Ban direct `useEffect` in React components. Use when writing, refactoring, or reviewing React code so derived state, data fetching, user actions, resets, and mount-only external synchronization use declarative replacement patterns instead of dependency-array choreography.
95
95%
Does it follow best practices?
Impact
98%
1.02xAverage score across 4 eval scenarios
Passed
No known issues
{
"context": "Tests whether react-ban-use-effect can encode the policy into lint rules while preserving a narrow domain-specific external-integration hook with honest reactive dependencies and existing hook guardrails.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Import ban",
"description": "ESLint blocks importing `useEffect` from `react` in normal application code, for example with `no-restricted-imports`",
"max_score": 14
},
{
"name": "Namespace call ban",
"description": "ESLint blocks `React.useEffect(...)` namespace calls in normal application code, for example with `no-restricted-syntax`",
"max_score": 14
},
{
"name": "Hook exception scoped",
"description": "The policy allows direct useEffect only in `src/hooks/useChatConnection.ts` or an equivalently narrow named external-integration hook path",
"max_score": 12
},
{
"name": "Domain hook owns lifecycle",
"description": "`useChatConnection` calls connectChat with serverUrl and roomId, opens the connection, and closes that same connection during effect cleanup",
"max_score": 12
},
{
"name": "Reactive dependencies explicit",
"description": "The hook accepts serverUrl and roomId explicitly and lists both in its effect dependency array so either change reconnects",
"max_score": 14
},
{
"name": "No hidden dependency escape",
"description": "The solution does not add a generic EffectCallback/dependency-array wrapper and does not suppress react-hooks/exhaustive-deps",
"max_score": 10
},
{
"name": "Hooks lint preserved",
"description": "Existing `react-hooks/rules-of-hooks` and `react-hooks/exhaustive-deps` enforcement is preserved or strengthened, not disabled globally",
"max_score": 8
},
{
"name": "No unrelated bans",
"description": "The policy does not ban unrelated APIs such as `useLayoutEffect` or non-React effect systems unless requested",
"max_score": 6
},
{
"name": "Message points to replacements",
"description": "Lint messages direct developers toward declarative replacements or reviewed external-integration hooks rather than dependency-array tuning",
"max_score": 5
},
{
"name": "Verification named",
"description": "The report says to run lint and includes positive/negative checks for blocked imports, blocked namespace calls, and the allowed domain hook",
"max_score": 5
}
]
}