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: universal
readabilitynamingrefactoring
Extract a complex or repeated boolean condition into a named predicate
Give a long or reused conditional a descriptive name (function/getter) so the call site reads as intent rather than mechanics.
PR: hegnar-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | if (a.closest('.x').children().children().children().length === 1 || b > c && !d) { /* ... */ } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const isTopLevelSlot = (el: Element) => /* the same condition */; |
| 2 | if (isTopLevelSlot(el)) { /* ... */ } |
Explanation (EN)
Objašnjenje (HR)