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: JavaScript
correctnesslogicbugs
Use the correct logical operator in null-guard conditions
Watch out for && vs || in guard clauses: combining two negated checks with && can make the condition unreachable, so confirm the intended logic.
PR: vinify-frontend · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codets
| 1 | if (!obj && !obj?.id) return null; // second check unreachable |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | if (!obj || !obj.id) return null; |
Explanation (EN)
Objašnjenje (HR)