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: typescript
nullishreadabilitydead-code
Drop fallbacks that cannot change the outcome
A trailing `?? null` (or `|| undefined`) after an optional chain whose consumers already use `?.` adds nothing; remove it rather than normalising `undefined` to `null` for no reader.
PR: hegnar-web#4698 FCK-3550 Drive ad suppression from the article flagCreated: Sep 7, 2026
Bad example
Old codets
| 1 | const locals = useCtx()?.res.locals ?? null; |
| 2 | if (locals?.adFree) return null; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | const locals = useCtx()?.res.locals; |
| 2 | if (locals?.adFree) return null; |
Explanation (EN)
Objašnjenje (HR)