Warns when using setTimeout/setInterval inside Effect generators instead of Effect.sleep/Schedule
| Property | Value |
|---|---|
| Category | Effect-native |
| Default severity | off |
| Fixable | No |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377073 |
| Language Service name | globalTimersInEffect |
| Oxlint name | effecttsgo/global-timers-in-effect |
import { Effect } from "effect"
export const preview = Effect.gen(function*() {
setTimeout(() => {}, 100)
/**
^^^^^^^^^^^^^^^^^^^^^^^^^ effecttsgo(global-timers-in-effect): This Effect code uses `setTimeout`, the corresponding timer API in this context is `Effect.sleep or Schedule` from Effect.
*/
})See the Language Service setup guide for installation instructions.
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-timers-in-effect": "warn"
}
}
{ "$schema": "./node_modules/@effect/tsgo/schema.json", "compilerOptions": { "plugins": [ { "name": "@effect/language-service", "diagnosticSeverity": { "globalTimersInEffect": "warning" } } ] } }