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).
backend ruleP0universalStack: typescript
correctnessbooleandefaultsbug
Do not use `value || true` as a default — it is always true
An `x || true` expression collapses to true regardless of x; use the correct default (often `x ?? false`) and match it to the backing source.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | get shouldAppear(): boolean { |
| 2 | return this.data.shouldAppear || true; // always true |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | get shouldAppear(): boolean { |
| 2 | return this.data.shouldAppear ?? false; |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)