preferUnsafeConstructor
August 4, 2026 ยท View on GitHub
Suggests replacing Effect.runSync of a pure effect constructor with the synchronous *Unsafe variant exported by the same module
| Property | Value |
|---|---|
| Category | Anti-pattern |
| Default severity | suggestion |
| Fixable | Yes |
| Effect versions | v4 |
| Diagnostic codes | TS377109 |
| Language Service name | preferUnsafeConstructor |
| Oxlint name | effecttsgo/prefer-unsafe-constructor |
Preview
import { Effect, Scope } from "effect"
export const scope = Effect.runSync(Scope.make())
/**
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ effecttsgo(prefer-unsafe-constructor): `Effect.runSync(Scope.make(...))` starts a fiber to run a pure constructor. Use the synchronous variant `Scope.makeUnsafe(...)` instead.
*/
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": {
"preferUnsafeConstructor": "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/prefer-unsafe-constructor": "warn"
}
}