no-useeffect
No Direct useEffect
Rule: Never call useEffect directly. All 5 replacement patterns below cover every legitimate use case.
useMountEffect — The Only Allowed Effect Wrapper
export function useMountEffect(effect: () => void | (() => void)) {
// eslint-disable-next-line react-hooks/exhaustive-deps
useEffect(effect, []);
}
Use useMountEffect only for one-time external system sync (DOM, third-party widgets, browser APIs). For anything else, use Rules 1-3 or 5.
Rule 1: Derive State, Don't Sync It
Smell: useEffect(() => setX(deriveFromY(y)), [y]) or state that mirrors other state/props.
More from ahonn/dotfiles
seo-backlink-strategy
Backlink acquisition strategies. Use when: developing link building campaigns, analyzing competitor backlinks. Triggers on: 'backlinks', 'link building', 'domain authority'.
42react-best-practices
React best practices from react.dev and Vercel. Use when: (1) Reviewing React code, (2) Debugging performance issues, (3) Optimizing bundle size, (4) Writing effects or state logic. Triggers on: React performance, re-render, bundle size, waterfalls, code splitting, memo, useCallback, useMemo, useEffect, SSR flicker, initial load slow, React Compiler, state structure, immutable update, setState array object.
14rust-design-patterns
Rust idioms and design patterns for writing idiomatic code. Use when: (1) Writing new Rust code, (2) Reviewing Rust code, (3) Solving borrow checker issues, (4) Designing Rust APIs. Triggers on: Rust ownership problems, lifetime errors, API design questions, 'how to do X idiomatically in Rust'.
14comment-cleanup
Clean up code comments. Use when: improving comment quality, removing redundant comments. Triggers on: 'clean up comments', 'comment cleanup'.
12skill-creator
Guide for creating Claude skills. Use when: creating or updating skills. Triggers on: 'create skill', 'new skill', 'skill template'.
12agent-browser
Browser automation for web testing, screenshots, data extraction. Use when: navigating websites, filling forms, testing web apps. Triggers on: 'open browser', 'screenshot', 'click element'.
11