Rules

no-fetch

Use Effect HttpClient instead of calling global fetch.

Purpose and behavior

Use Effect HttpClient instead of calling global fetch.

Reports fetch(), globalThis.fetch(), window.fetch() and self.fetch(). Arbitrary client.fetch calls and references without a direct call are ignored. Model HTTP requirements as services and 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 reports diagnostics without an automatic fix. Rewrite the code deliberately rather than guessing its intended semantics.

For a genuine boundary exception, use an oxlint-disable-next-line rules/no-fetch -- reason comment. Examples illustrate this rule alone and may omit imports and declarations.

Source and tests

Enabled by the Effect preset.

no-fetch.ts · Tests