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 ruleP1universalStack: JavaScript
fetchasyncpromisescorrectness
Await response.json() before returning the parsed body
response.json() returns a promise; await it before assigning/returning so callers get data, not a pending promise.
PR: hegnar-zephr-components · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codets
| 1 | return { success: res.status === 200, data: res.json() }; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | return { success: res.status === 200, data: await res.json() }; |
Explanation (EN)
Objašnjenje (HR)