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: TypeScript
asyncreadabilitycontrol-flowclean-code
Use an explicit if instead of || with an awaited value
Don't combine await with the || operator for control flow; an explicit if statement is clearer and avoids surprising short-circuit/await interactions.
PR: hegnar-forum-web · org-mining-3rd-2026-06Created: Jun 18, 2026
Bad example
Old codets
| 1 | const result = (await fetchA()) || (await fetchB()); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | let result = await fetchA(); |
| 2 | if (!result) { |
| 3 | result = await fetchB(); |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)