Skip to content

Latest commit

 

History

History
63 lines (51 loc) · 1.43 KB

sync-to-succeed.md

File metadata and controls

63 lines (51 loc) · 1.43 KB

syncToSucceed

Suggests using Effect.succeed instead of Effect.sync when the thunk returns a constant value

Property Value
Category Style
Default severity suggestion
Fixable Yes
Effect versions v3, v4
Diagnostic codes TS377103
Language Service name syncToSucceed
Oxlint name effecttsgo/sync-to-succeed

Preview

import { Effect } from "effect"

export const preview = Effect.sync(() => "constant")
/**
                       ^^^^^^^^^^^ effecttsgo(sync-to-succeed): `Effect.succeed` expresses this constant value more directly than `Effect.sync`.
*/

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": {
          "syncToSucceed": "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/sync-to-succeed": "warn"
  }
}