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
namingservicesclean-codereadability
Name service methods so the verb and noun match what is returned
A method named getX should return an X; if you are already inside a named journey/context, drop the redundant qualifier and ensure the returned value matches the noun in the name.
PR: hegnar-zephr-components · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | // inside CookieJourney service |
| 2 | getNextJourneyPage(): { nextStep: string } // redundant 'Journey', returns 'nextStep' not a 'page' |
| 3 |
|
| 4 | getPopupStateFromCookie(): CookieData // says state, returns cookie data |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | getNextPage(): { page: string } |
| 2 |
|
| 3 | getPopupState(): PopupState |
Explanation (EN)
Objašnjenje (HR)