Severity: warning
Category: lint
Stage: Stage 3
Description
A match expression must contain at least one arm. An empty match is almost certainly a mistake
and will always throw at runtime when evaluated.
Example
type Status = Active | Inactive
// ✗ lint warning
const r = match s {} // SJS-L006Fix
Add arms for every variant, or remove the match if it is not needed:
// ✓ correct
const r = match s {
Active => 1,
Inactive => 0,
}Configuration
{
"lint": {
"L006": "error" | "warn" | "off"
}
}Default: "warn" in standard mode, "error" in --strict mode.
Related codes
SJS-E007— non-exhaustivematch(type error when variants are missing)SJS-L007— redundant match arm