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 ruleP1universalStack: react
conditional-renderingdefensivecorrectnessnull-safety
Handle the fallthrough state so a render branch can't crash
Make sure an else/fallback branch can't be reached with data it isn't prepared to render, or guard it explicitly.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetsx
| 1 | if (subscription && grant) return <Sub data={subscription} />; |
| 2 | return <Sub data={subscription} />; // subscription may be undefined here |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | if (subscription) return <Sub data={subscription} />; |
| 2 | if (grant) return <CourtesyGrant />; |
| 3 | return <Registered />; |
Explanation (EN)
Objašnjenje (HR)