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).
frontend ruleP1universalStack: javascript
asyncfetchcleanupdead-code
An AbortController you create must actually be used to abort, or removed
Don't instantiate an AbortController and never call abort(); either wire it up to cancel stale requests or delete it.
PR: hegnar-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | const controller = new AbortController(); |
| 2 | await fetch(url, { signal: controller.signal }); |
| 3 | // controller.abort() is never called |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const controller = new AbortController(); |
| 2 | activeRequest?.abort(); // cancel the previous in-flight load |
| 3 | activeRequest = controller; |
| 4 | await fetch(url, { signal: controller.signal }); |
Explanation (EN)
Objašnjenje (HR)