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: javascript
fetchhttpredundancy
Trust response.ok instead of re-checking the HTTP status range
response.ok already covers the 2xx range, so a redundant numeric status check after it is unnecessary unless the payload carries its own status field.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetypescript
| 1 | if (!response.ok) return; |
| 2 | if (response.status < 200 || response.status >= 300) return; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | if (!response.ok) return; |
| 2 | // payload-level status (json.status) is a separate concern, check it explicitly |
Explanation (EN)
Objašnjenje (HR)