Skip to content

require-fetch-timeout

Require an explicit abort signal on locally analyzable global fetch calls.

Why

An unbounded request can occupy work indefinitely when an upstream stalls.

Fix

Pass an abort signal, such as AbortSignal.timeout(ms), in the fetch init.

Examples

Before — flagged Do not leave fetch unbounded
src/client.ts
await fetch("https://api.example.com/items");
After — preferred Bound the request
src/client.ts
await fetch(url, { signal: AbortSignal.timeout(5000) });

Options

{
"additionalProperties": false,
"properties": {
"allowIn": {
"description": "Glob patterns for wrapper modules exempt from the rule. Matched against the ABSOLUTE file path, so anchor with a `**/` prefix (e.g. `**/http-client.ts`).",
"items": { "type": "string" },
"type": "array"
}
},
"type": "object"
}