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).
fullstack ruleP2universalStack: any
performanceearly-returnordering
Check guard conditions before doing expensive or unnecessary work
Move validation/early-return checks above any parsing or computation they invalidate, so you don't do work that gets thrown away.
PR: hegnar-forum-web · org-mining-3rd-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | const parsedDate = parse(input); |
| 2 | if (!isValid(input)) return; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | if (!isValid(input)) return; |
| 2 | const parsedDate = parse(input); |
Explanation (EN)
Objašnjenje (HR)