Skip to content

Latest commit

 

History

History
64 lines (52 loc) · 1.68 KB

error-payload-shadows-name.md

File metadata and controls

64 lines (52 loc) · 1.68 KB

errorPayloadShadowsName

Detects error payload fields named name that shadow the error's own name

Property Value
Category Correctness
Default severity suggestion
Fixable No
Effect versions v3, v4
Diagnostic codes TS377145
Language Service name errorPayloadShadowsName
Oxlint name effecttsgo/error-payload-shadows-name

Preview

import { Data } from "effect"

export class ToolNotFound extends Data.TaggedError("ToolNotFound")<{ readonly name: string }> {}
/**
                                                                              ^^^^ effecttsgo(error-payload-shadows-name): The payload field `name` shadows this error's own `name`, so logs and `String(error)` show the field value instead of the error type. Consider renaming it.
*/
new ToolNotFound({ name: "search" }).name

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": {
          "errorPayloadShadowsName": "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/error-payload-shadows-name": "warn"
  }
}