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

NOTE: the latest version is 2.0.1

NoCatchAllForSpecificRemainingPatterns

rule : Rule

Enforces listing all specific cases if possible

config =
    [ NoCatchAllForSpecificRemainingPatterns.rule
    ]

reported

type Resource
    = Loaded String
    | FailedToLoad String
    | Loading


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


        _ ->
            Ui.spinner


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


        _ ->
            False

allowed

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


        FailedToLoad reason ->
            Ui.text ("failed to load due to " ++ reason)


        Loading ->
            Ui.spinner


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


        FailedToLoad _ ->
            False


        Loading ->
            False

This works for variant, list and cons patterns.