fysiweb / elm-review-sorted / NoUnsortedRecordFields

rule : Review.Rule.Rule

Reports...

config =
    [ NoUnsortedRecordFields.rule
    ]

Fail

type alias Foo =
    { b : Int, a : Int }

foo : Foo
foo =
    { b = 1, a = 2 }

sumFoo : Foo -> Int
sumFoo { b, a } =
    a + b

Success

type alias Foo =
    { a : Int, b : Int }

foo : Foo
foo =
    { a = 2, b = 1 }

sumFoo : Foo -> Int
sumFoo { a, b } =
    a + b

When (not) to enable this rule

This rule is useful when you want to enforce sorting in record fields. THis rule is not useful when you don't.