Skip to content

Latest commit

 

History

History
65 lines (52 loc) · 1.5 KB

new-schema-class.md

File metadata and controls

65 lines (52 loc) · 1.5 KB

newSchemaClass

Suggests using Schema make instead of new for Schema classes

Property Value
Category Style
Default severity off
Fixable Yes
Effect versions v4
Diagnostic codes TS377094
Language Service name newSchemaClass
Oxlint name effecttsgo/new-schema-class

Preview

import { Schema } from "effect"

class User extends Schema.Class<User>("User")({ name: Schema.String }) {}

export const preview = new User({ name: "John" })
/**
                           ^^^^ effecttsgo(new-schema-class): This Schema class is constructed with `new`. `User.make(...)` can be used to construct the Schema class instance.
*/

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": {
          "newSchemaClass": "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/new-schema-class": "warn"
  }
}