Skip to content

Latest commit

 

History

History
65 lines (53 loc) · 1.48 KB

effect-fn-opportunity.md

File metadata and controls

65 lines (53 loc) · 1.48 KB

effectFnOpportunity

Suggests using Effect.fn for functions that return an Effect

Property Value
Category Style
Default severity suggestion
Fixable Yes
Effect versions v3, v4
Diagnostic codes TS377047
Language Service name effectFnOpportunity
Oxlint name effecttsgo/effect-fn-opportunity

Preview

import * as Effect from "effect/Effect"

export const preview = () => Effect.gen(function*() {
/**
             ^^^^^^^ effecttsgo(effect-fn-opportunity): This expression can be rewritten in the reusable function form `Effect.fn(function*() { ... })`.
*/
  return yield* Effect.succeed(1)
})

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": {
          "effectFnOpportunity": "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/effect-fn-opportunity": "warn"
  }
}