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 ruleP2universalStack: JavaScript
clean-codecontrol-flowsimplicity
Merge branches that produce the same result
If two condition branches return or set the same thing, collapse them into a single branch or a shared else.
PR: vinify-frontend · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codets
| 1 | if (a) doX(); |
| 2 | else if (b) doX(); |
| 3 | else doY(); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | if (a || b) doX(); |
| 2 | else doY(); |
Explanation (EN)
Objašnjenje (HR)