Rules

no-fetch

Use Effect HttpClient instead of calling global fetch.

Purpose and behavior

Use Effect HttpClient instead of calling global fetch.

The rule reports fetch(), globalThis.fetch(), window.fetch() and self.fetch(). The rule ignores other client.fetch calls and references without a call. Use HTTP services that preserve typed errors.

Options

No configurable options. Enable with "rules/no-fetch": "error".

Invalid example

fetch('https://example.com')

Valid example

httpClient.get('https://example.com')

Fixes and exceptions

This rule provides no automatic fix. Rewrite the code to preserve its intended behavior.

For a boundary exception, use oxlint-disable-next-line rules/no-fetch -- reason. Examples cover this rule only and may omit imports or declarations.

Source and tests

Enabled by the Effect preset.

no-fetch.ts · Tests