Skip to content

Latest commit

 

History

History
64 lines (52 loc) · 1.58 KB

prefer-schema-type-property.md

File metadata and controls

64 lines (52 loc) · 1.58 KB

preferSchemaTypeProperty

Disallows Schema.Schema.Type and Schema.Codec.Encoded-style helpers in favor of typeof X.Type and typeof X.Encoded

Property Value
Category Style
Default severity off
Fixable Yes
Effect versions v3, v4
Diagnostic codes TS377104
Language Service name preferSchemaTypeProperty
Oxlint name effecttsgo/prefer-schema-type-property

Preview

import { Schema } from "effect"

const User = Schema.Struct({ name: Schema.String })
type User = Schema.Schema.Type<typeof User>
/**
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ effecttsgo(prefer-schema-type-property): Do not use `Schema.Schema.Type<typeof X>`. Use `typeof X.Type` 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": {
          "preferSchemaTypeProperty": "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-schema-type-property": "warn"
  }
}