Skip to content

Latest commit

 

History

History
65 lines (52 loc) · 1.55 KB

schema-sync.md

File metadata and controls

65 lines (52 loc) · 1.55 KB

schemaSync

Suggests Effect-based Schema decoding and encoding instead of synchronous methods

Property Value
Category Effect-native
Default severity off
Fixable No
Effect versions v3, v4
Diagnostic codes TS377130
Language Service name schemaSync
Oxlint name effecttsgo/schema-sync

Preview

import * as Schema from "effect/Schema"

const Person = Schema.Struct({ name: Schema.String })

export const person = Schema.decodeUnknownSync(Person)({ name: "Ada" })
/**
                      ^^^^^^^^^^^^^^^^^^^^^^^^ effecttsgo(schema-sync): `Schema.decodeUnknownSync` executes synchronously. Use `Schema.decodeUnknownEffect` to compose this operation through Effect without throwing.
*/

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": {
          "schemaSync": "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/schema-sync": "warn"
  }
}