Conditionals
Put the rejection path first. When an operation receives a variant, make its possible outcomes visible in one exhaustive match.
Branching
Why
A reader should not have to trace nested branches to find the successful installation path. Adding a source variant should also make incomplete handlers fail typechecking.
Rules
MUST check a precondition or single condition with a bracedifthat returns early.[review]
MUST express a two-outcome choice with guard-clause returns.[review]
MUST handle unions and choices with three or more outcomes usingmatchfrommassaman/match.[review]
MUST close matches on repository-owned unions with.exhaustive().[review]
MAY finish with.otherwise()only for an open input domain, such as an external string or payload.[review]
MUST avoid ternary expressions,switch,else ifchains, and guards nested around the successful path.[review]
MUST consume the narrowed match argument rather than asserting a variant type.[review]
SHOULD usewhen,unless, orifElsewhen a conditional is part of a composed pipeline.[review]
[review]
Typed exhaustive matches establish closed-variant handling. Configure syntax-specific lint rules to reject forbidden branching forms; review checks guard structure and open-domain fallbacks.
JSX
Why
JSX renders a numeric left operand even when an && expression short-circuits. Explicit state handling avoids stray output and forgotten variants.
Rules
MUST give conditional&&rendering a boolean left operand.[review]
MUST use component guard returns for two rendering outcomes.[review]
MUST render discriminated state unions through exhaustive matches.[review]
Introducing the matching dependency requires any approval specified by the consumer's operating instructions. Read the shared principles before selecting dependencies.
[review]
Typed exhaustive matches establish closed-variant handling. Configure syntax-specific lint rules to reject forbidden branching forms; review checks guard structure and open-domain fallbacks.
Enforcement
Typed exhaustive matches establish closed-variant handling. Configure syntax-specific lint rules to reject forbidden branching forms; review checks guard structure and open-domain fallbacks.