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 |
export const preview = Math.random()
/**
^^^^^^^^^^^^^ effecttsgo(global-random): This code uses `Math.random()`, randomness is represented through the Effect `Random` service.
*/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-random": "warn"
}
}
{ "$schema": "./node_modules/@effect/tsgo/schema.json", "compilerOptions": { "plugins": [ { "name": "@effect/language-service", "diagnosticSeverity": { "globalRandom": "warning" } } ] } }