lue-bird/elm-review-no-catch-all-for-specific-remaining-patterns/2.0.1

NoCatchAllForSpecificRemainingPatterns

rule : { onlyReportCatchAllIfEquivalentToSinglePattern : Bool } -> Rule

Enforces listing all specific cases if possible

config =
    [ NoCatchAllForSpecificRemainingPatterns.rule
        { onlyReportCatchAllIfEquivalentToSinglePattern = True }
    ]

reported

type Resource
    = Loaded String
    | FailedToLoad String
    | Loading


-- with any configuration
displayResource : Resource -> Ui
displayResource resource =
    case resource of
        Loaded text ->
            Ui.text text


        FailedToLoad error ->
            Ui.error error


        _ ->
            Ui.spinner


-- only with { onlyReportCatchAllIfEquivalentToSinglePattern = False }
resourceIsLoaded : Resource -> Bool
resourceIsLoaded resource =
    case resource of
        Loaded _ ->
            True


        _ ->
            False

allowed

-- with any configuration
resourceIsLoaded : Resource -> Bool
resourceIsLoaded resource =
    case resource of
        Loaded _ ->
            True


        FailedToLoad _ ->
            False


        Loading ->
            False


-- only with { onlyReportCatchAllIfEquivalentToSinglePattern = True }
displayResource : Resource -> Ui
displayResource resource =
    case resource of
        Loaded text ->
            Ui.text text


        _ ->
            Ui.spinner

This works for variant, list and cons patterns.