Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP2stack specificStack: react
react-hookslintingdependenciesclarity
Document why a referentially-stable value is in (or out of) a dep array
For stable values like the router, either omit them with a lint-disable comment explaining why, or keep them with a comment; don't leave the reader guessing.
PR: hegnar-journalist-boost · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetsx
| 1 | useEffect(() => { router.push(href); }, [router]); // is router even needed here? |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | // router is referentially stable; safe to omit |
| 2 | // eslint-disable-next-line react-hooks/exhaustive-deps |
| 3 | useEffect(() => { router.push(href); }, [href]); |
Explanation (EN)
Objašnjenje (HR)