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 ruleP2project specificStack: javascript
consistencybooleanstyle
Cast to boolean consistently across the codebase
Pick one boolean-coercion idiom (e.g. Boolean(x)) and use it everywhere instead of mixing Boolean() and !! for the same purpose.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetypescript
| 1 | const hasReplies = !!replies?.length; // inconsistent with the rest of the codebase |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const hasReplies = Boolean(replies?.length); |
Explanation (EN)
Objašnjenje (HR)