lue-bird/elm-review-variant-value-count/1.0.0

NOTE: the latest version is 1.0.2

Limit the number of allowed values on a variant to 1 at most by using the elm-review rule Review.VariantValueCount.zeroOrOne

try it

elm-review --template lue-bird/elm-review-variant-value-count/example

add it to your config

module ReviewConfig exposing (config)

import Review.VariantValueCount
import Review.Rule

config : List Review.Rule.Rule
config =
    [ Review.VariantValueCount.zeroOrOne
    ]

why

A variant with multiple arguments is very similar to automatic record type alias constructor functions and arbitrary-size tuples in that its parts can only be differentiated by position.

All three share the same problem: This position is usually neither obvious nor descriptive. A missed chance to let the code be self-documenting!

Even when you think it's clear, there are likely implicit roles of the variant values:

type Msg
    = MessageReceived User Message

turns out in this case it was supposed to have been

type Msg
    = MessageReceived { recipient : User, message : Message }

One valid criticism is that case patterns now can't be nested and so casing becomes more verbose. And I will never disagree with you on that. Pattern matching on records is just a missing feature in elm.