globalRandom
August 4, 2026 ยท View on GitHub
Warns when using Math.random() outside Effect generators instead of the Random service
| Property | Value |
|---|---|
| Category | Effect-native |
| Default severity | off |
| Fixable | No |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377070 |
| Language Service name | globalRandom |
| Oxlint name | effecttsgo/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"
}
}