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: javascript
readabilitycontrol-flowclean-code
Don't combine assignment and a conditional check in one confusing expression
Split a statement that both performs a check and calls a function into clearer, separate steps so the control flow is obvious.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | if (!email && validateEmail(email)) submit(); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | if (!email) { |
| 2 | setEmailError(true); |
| 3 | return; |
| 4 | } |
| 5 | submit(); |
Explanation (EN)
Objašnjenje (HR)