Skip to content

Latest commit

 

History

History
61 lines (50 loc) · 1.43 KB

global-fetch.md

File metadata and controls

61 lines (50 loc) · 1.43 KB

globalFetch

Warns when using the global fetch function outside Effect generators instead of the Effect HTTP client

Property Value
Category Effect-native
Default severity off
Fixable No
Effect versions v3, v4
Diagnostic codes TS377061
Language Service name globalFetch
Oxlint name effecttsgo/global-fetch

Preview

export const preview = fetch("https://example.com")
/**
                       ^^^^^ effecttsgo(global-fetch): This code uses the global `fetch` function, HTTP requests are represented through `HttpClient` from `@effect/platform`.
*/

Language Service Configuration

See the Language Service setup guide for installation instructions.

{
  "$schema": "./node_modules/@effect/tsgo/schema.json",
  "compilerOptions": {
    "plugins": [
      {
        "name": "@effect/language-service",
        "diagnosticSeverity": {
          "globalFetch": "warning"
        }
      }
    ]
  }
}

Oxlint Configuration

See the Oxlint setup guide for installation and patching instructions.

{
  "$schema": "./node_modules/@effect/tsgo/oxlint-schema.json",
  "options": {
    "typeAware": true
  },
  "plugins": ["effecttsgo"],
  "rules": {
    "effecttsgo/global-fetch": "warn"
  }
}