globalDateInEffect

August 4, 2026 ยท View on GitHub

Warns when using Date.now() or new Date() inside Effect generators instead of Clock/DateTime

PropertyValue
CategoryEffect-native
Default severityoff
FixableNo
Effect versionsv3, v4
Diagnostic codesTS377067, TS377069
Language Service nameglobalDateInEffect
Oxlint nameeffecttsgo/global-date-in-effect

Preview

import { Effect } from "effect"

export const preview = Effect.gen(function*() {
  const now = Date.now()
/**
              ^^^^^^^^^^ effecttsgo(global-date-in-effect): This Effect code uses `Date.now()`, time access in Effect code is represented through `Clock` from Effect.
*/
  return now
})

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": {
          "globalDateInEffect": "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-date-in-effect": "warn"
  }
}