menu

no-duplicate-match-arms

Disallow match arms with identical bodies

Identical match arm bodies often indicate an editing mistake and repeat one result. Instead, you SHOULD correct an unintended body or combine the patterns when their guards match.

Reported

1function describe(value: int32): string {2    return match (value) {3        0 => "small"4        1 => "small"5        _ => "large"6    };7}

Accepted

1function describe(value: int32): string {2    return match (value) {3        0 | 1 => "small"4        _ => "large"5    };6}