Rules Hub
Code Ruleset
← 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)
A signal that can never be aborted adds lifecycle machinery without cancellation behavior.
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)
Notes (EN)
Trace controller ownership from request creation through replacement, disposal and explicit cancellation before deciding it is unused.
Exceptions / Tradeoffs (EN)
A controller handed to another owner may be aborted there. Keep the signal when cancellation belongs to that caller.