globalRandom

August 4, 2026 ยท View on GitHub

Warns when using Math.random() outside Effect generators instead of the Random service

PropertyValue
CategoryEffect-native
Default severityoff
FixableNo
Effect versionsv3, v4
Diagnostic codesTS377070
Language Service nameglobalRandom
Oxlint nameeffecttsgo/global-random

Preview

export const preview = Math.random()
/**
                       ^^^^^^^^^^^^^ effecttsgo(global-random): This code uses `Math.random()`, randomness is represented through the Effect `Random` service.
*/

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": {
          "globalRandom": "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-random": "warn"
  }
}