TypeScript · architecture
no-raw-fetch-outside-clients
eslint:no-raw-fetch-outside-clients Disallow calling the global `fetch` outside the client layer; route outbound HTTP through a client module that owns retry, timeout and status handling.
- Default
- error
- Fix
- none
- Languages
- typescript
Why
Scattered fetch calls bypass shared transport policy and are harder to stub and observe consistently.
Fix
Move the request into a client module and call that abstraction from application code.
Before / after
Executed by this rule’s unit tests.
Before
Do not call global fetch here
const response = await fetch('/api/invoices'); After
Use a client abstraction
const response = await billingClient.getInvoice(id); Limits
- Tests, client-layer paths, constructed handoffs, and pre-signed URL transfers are excluded.
Message IDs
rawFetch