Warns when using JSON.parse or JSON.stringify outside Effect generators instead of Effect Schema
| Property | Value |
|---|---|
| Category | Effect-native |
| Default severity | off |
| Fixable | No |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377156 |
| Language Service name | globalJson |
| Oxlint name | effecttsgo/global-json |
import { Schema } from "effect"
const User = Schema.Struct({ name: Schema.String })
export const parseUser = (text: string) => Schema.decodeUnknownSync(User)(JSON.parse(text))
/**
^^^^^^^^^^^^^^^^ effecttsgo(global-json): This code uses `JSON.parse`, which throws instead of failing with a typed error. Use `Schema.fromJsonString(Schema.Unknown)` for unknown shapes, `Schema.fromJsonString(schema)` for known ones, or `Schema.toCodecJson(schema)` when working with JSON values instead of strings.
*/See the Language Service setup guide for installation instructions.
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/global-json": "warn"
}
}
{ "$schema": "./node_modules/@effect/tsgo/schema.json", "compilerOptions": { "plugins": [ { "name": "@effect/language-service", "diagnosticSeverity": { "globalJson": "warning" } } ] } }