lue-bird / elm-review-record-alias-constructor / NoRecordAliasConstructor

rule : Review.Rule.Rule

🔧NoRecordAliasConstructor forbids using a record type alias constructor function.

Read more about the why in no-record-type-alias-constructor-function.

examples

type alias User =
    { name : String, age : Int }

User "Balsa" 42

will be marked as error and automatically fixed:

{ name = "Balsa", age = 42 }

The same goes for cases where no arguments are applied:

map2 User
    (field "name" string)
    (field "age" int)

fixed

map2 (\name age -> { name = name, age = age })
    (field "name" string)
    (field "age" int)

See the readme for why this is useful.

configuration

import NoRecordAliasConstructor

config : List Rule
config =
    [ NoRecordAliasConstructor.rule
    ]