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 + TypeScript
refstype-safetyhooks
Always give useRef an explicit type
Annotate refs with the element/value type so they aren't inferred as never or any.
PR: hegnar-forum-web · org-mining-3rd-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | const eventSourceRef = useRef(); // untyped |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | const eventSourceRef = useRef<EventSource | null>(null); |
Explanation (EN)
Objašnjenje (HR)