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
api-designencapsulationclean-codecohesion
Do not expose two methods that are never used apart from each other
If two public methods are always called together, collapse them into one method that does the combined work, keeping the intermediate logic encapsulated.
PR: hegnar-zephr-components · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | const url = service.getRedirectUrl(cookie); |
| 2 | const step = service.getNextStep(cookie); // always called right after getRedirectUrl |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // one method owns the combined logic |
| 2 | const next = service.getNextStep(cookie, { redirectToMarketData }); |
Explanation (EN)
Objašnjenje (HR)