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
readabilityapi-designbooleans
Pass boolean and optional arguments through a named options object
A bare `true`/`false`/`undefined` positional argument is unreadable at the call site; take an options object so the key names the meaning (`{ adFree: true }`).
PR: hegnar-web#4698 FCK-3550 Drive ad suppression from the article flagCreated: Sep 7, 2026
Bad example
Old codets
| 1 | renderWithLocals(<Ad />, true); |
| 2 | shouldInsertBodyAds('Premium', undefined); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | renderWithLocals(<Ad />, { adFree: true }); |
| 2 | shouldInsertBodyAds({ articleType: 'Premium', adFree: undefined }); |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
A little verbosity at the definition buys clarity at every point of usage.