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 ruleP1universalStack: typescript
abstractionapiencapsulationservice-layer
Don't leak raw HTTP responses out of service functions
Have a service interpret the HTTP response internally and return a clean success/failure or domain value, not the raw response.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | async function saveAddress(addr): Promise<Response> { |
| 2 | return fetch('/api/address', { method: 'POST', body }); |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | async function saveAddress(addr): Promise<boolean> { |
| 2 | const res = await fetch('/api/address', { method: 'POST', body }); |
| 3 | return res.ok; |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)