truqu / elm-review-nobooleancase / NoBooleanCase

rule : Review.Rule.Rule

Prohibits using case <expr> of when <expr> returns a boolean

Expressions like

case some fun here of
    True ->
        doSomething

    False ->
        doSomethingElse

can be rewritten to a slightly more natural if .. then .. else .. expression like so:

if some fun here then
    doSomething

else
    doSomethingElse

This rule flags such expressions and proposes a fix to rewrite them accordingly.

To use this rule, add it to your elm-review config like so:

module ReviewConfig exposing (config)

import NoBooleanCase
import Review.Rule exposing (Rule)

config : List Rule
config =
    [ NoBooleanCase.rule
    ]