jfmengels/elm-review-unused/1.1.0

NOTE: the latest version is 1.2.6

NoUnused.CustomTypeConstructorArgs

rule : Rule

Reports arguments of custom type constructors that are never used.

config =
    [ NoUnused.CustomTypeConstructorArgs.rule
    ]

Custom type constructors can contain data that is never extracted out of the constructor. This rule will warn arguments that are always pattern matched using a wildcard (_).

For package projects, custom types whose constructors are exposed as part of the package API are not reported.

Fail

type CustomType
  = CustomType Used Unused


case customType of
  CustomType value _ -> value

Success

type CustomType
  = CustomType Used Unused


case customType of
  CustomType value maybeUsed -> value

When not to enable this rule?

If you like giving names to all arguments when pattern matching, then this rule will not found many problems. This rule will work well when enabled along with NoUnused.Patterns.

Try it out

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

elm-review --template jfmengels/elm-review-unused/example --rules NoUnused.CustomTypeConstructorArgs