Rules

no-option-tag-comparison

Use Option.isSome and Option.isNone instead of comparing _tag.

Purpose and behavior

Use Option.isSome and Option.isNone instead of comparing _tag.

The rule replaces _tag comparisons with Some or None using Option predicates. The rule checks syntax, not whether the object is an Option. Make the Option identifier available before applying the fix.

Options

No configurable options. Enable with "rules/no-option-tag-comparison": "error".

Invalid example

if (opt._tag === 'Some') {}

Valid example

if (Option.isSome(opt)) {}

Fixes and exceptions

This rule provides automatic fixes. Review each fix before applying it.

For a boundary exception, use oxlint-disable-next-line rules/no-option-tag-comparison -- reason. Examples cover this rule only and may omit imports or declarations.

Source and tests

Enabled by the Effect preset.

no-option-tag-comparison.ts · Tests