Skip to content
← All rules
AsyncConcurrency

async/require-race-loser-cleanup

Locally created branches that lose Promise.race or Promise.any need cancellation, settlement observation, or cleanup.

Promise.racecancellationcleanup
TypeScript
await Promise.race([fetch(url), delay(1000)]);
Finding

Require cleanup of locally owned race losers.

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-race-loser-cleanup": "warn"
Package
@scruple/async
Default threshold
Plugin default
Minimum confidence
Plugin default

Released under the MIT License.