dillonkearns / elm-review-no-primitive-type-alias / NoPrimitiveTypeAlias

rule : Review.Rule.Rule

Reports type aliases to single-value primitive types, like type alias UserId = String. Does not report errors for type aliases of Record, List, Dict, Maybe, or Result types (i.e. compound primitives).

config =
    [ NoPrimitiveTypeAlias.rule
    ]

Fail

type alias UserId =
    String

Success

type alias User =
    { first : String, last : String }

When (not) to enable this rule

This rule is useful when you want to make sure you can trust types to represent Custom Types that will give you helpful compiler feedback, as described in the Rationale section of the README. This rule is not useful when you have low-level workarounds where you are choosing to use simple primitive type aliases, or if you disagree with this advice choose to use that style as your personal preference.

Try it out

You can try this rule out by running the following command:

elm-review --template dillonkearns/elm-review-no-primitive-type-alias/example --rules NoPrimitiveTypeAlias