Skip to content

Latest commit

 

History

History
65 lines (54 loc) · 1.6 KB

strict-boolean-expressions.md

File metadata and controls

65 lines (54 loc) · 1.6 KB

strictBooleanExpressions

Enforces boolean types in conditional expressions for type safety

Property Value
Category Style
Default severity off
Fixable No
Effect versions v3, v4
Diagnostic codes TS377029
Language Service name strictBooleanExpressions
Oxlint name effecttsgo/strict-boolean-expressions

Preview

declare const value: string | undefined
export const preview = value ? 1 : 0
/**
                       ^^^^^ effecttsgo(strict-boolean-expressions): Unexpected `string` type in condition, expected strictly a boolean instead.
*/
/**
                       ^^^^^ effecttsgo(strict-boolean-expressions): Unexpected `undefined` type in condition, expected strictly a boolean 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": {
          "strictBooleanExpressions": "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/strict-boolean-expressions": "warn"
  }
}