AsyncCancellation
async/require-abort-listener-cleanup
Abort listeners should be one-shot or visibly removed or disposed so they do not outlive the operation they monitor.
01 Examples
TypeScript
signal.addEventListener("abort", cancel);Finding
Require cleanup of abort listeners.
02 Enable it
Setup
Install the package, register its plugin factory, then enable the rule.
Install the package
pnpm add -D @scruple/asyncRegister the plugin
In scruple.config.ts, register the factory under the async namespace used by the rule ID.
import { asyncRules } from "@scruple/async";
plugins: {
"async": asyncRules(),
},Enable the rule
"async/require-abort-listener-cleanup": "warn"- Package
@scruple/async- Default threshold
- Plugin default
- Minimum confidence
- Plugin default