Skip to content
← All rules
AsyncCancellation

async/require-cancellation-propagation

Functions with an explicit AbortSignal contract should forward that signal, directly or through composition, to platform fetch calls.

abort-signalfetchpropagation
TypeScript
async function load(signal: AbortSignal) { return fetch("/data"); }
Finding

Require accepted cancellation to be forwarded.

Setup

Install the package, register its plugin factory, then enable the rule.

Install the package

pnpm add -D @scruple/async

Register 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

Released under the MIT License.