Warns when using Date.now() or new Date() inside Effect generators instead of Clock/DateTime
| Property | Value |
|---|---|
| Category | Effect-native |
| Default severity | off |
| Fixable | No |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377067, TS377069 |
| Language Service name | globalDateInEffect |
| Oxlint name | effecttsgo/global-date-in-effect |
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
})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-date-in-effect": "warn"
}
}
{ "$schema": "./node_modules/@effect/tsgo/schema.json", "compilerOptions": { "plugins": [ { "name": "@effect/language-service", "diagnosticSeverity": { "globalDateInEffect": "warning" } } ] } }