Skip to content

Latest commit

 

History

History
71 lines (59 loc) · 1.57 KB

schema-opaque-instance-member.md

File metadata and controls

71 lines (59 loc) · 1.57 KB

schemaOpaqueInstanceMember

Disallows instance members in classes extending Schema.Opaque

Property Value
Category Correctness
Default severity error
Fixable No
Effect versions v4
Diagnostic codes TS377102
Language Service name schemaOpaqueInstanceMember
Oxlint name effecttsgo/schema-opaque-instance-member

Preview

import { Schema } from "effect"

class User extends Schema.Opaque<User>()(Schema.Struct({ name: Schema.String })) {
  displayName = "User"
/**
  ^^^^^^^^^^^ effecttsgo(schema-opaque-instance-member): Classes extending `Schema.Opaque` must not declare instance members.
*/
  greet() {
/**
  ^^^^^
*/
    return `Hello, ${this.displayName}`
  }
}

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": {
          "schemaOpaqueInstanceMember": "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-opaque-instance-member": "warn"
  }
}