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 ruleP2universalStack: TypeScript
simplicityapi-designcohesion
Don't read fields off an object only to pass them straight back in
If a found object can act on itself, call its method directly instead of extracting its props and feeding them back to it.
PR: hegnar-zephr-components · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | const { filteredProps } = findActiveJourney(props); |
| 2 | return journeyService.getNextStep(filteredProps); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const active = findActiveJourney(props); |
| 2 | if (!active) return null; |
| 3 | return active.getNextStep(); |
Explanation (EN)
Objašnjenje (HR)