AsyncCancellation
async/require-cancellation-propagation
Functions with an explicit AbortSignal contract should forward that signal, directly or through composition, to platform fetch calls.
01 Examples
TypeScript
async function load(signal: AbortSignal) { return fetch("/data"); }Finding
Require accepted cancellation to be forwarded.
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-cancellation-propagation": "warn"- Package
@scruple/async- Default threshold
- 0.9
- Minimum confidence
- 0.7