Report variables or types that are declared or imported but never used.
🔧 Running with --fix will automatically remove all the reported errors.
config =
[ NoUnused.Variables.rule
]
Fail
module A exposing (a, b)
import UnusedImport
a n =
n + 1
b =
let
unused =
some thing
_ =
someOther thing
in
2
c =
a 2
Success
module A exposing (a, b)
a n =
n + 1
b =
2
Exception
To avoid resorting to weird workarounds that are sometimes used in internal interactive examples, the rule won't report
values assigned to _ if a direct call to Debug.log is assigned to it.
a value =
let
_ =
Debug.log "value" value
in
value + 1
If you enable the NoDebug.Log rule
from the jfmengels/elm-review-debug package,
and configure it to ignore the locations where it's acceptable, then the combination of both rules will make sure to
clean up code like the above in all the other locations.
Try it out
You can try this rule out by running the following command:
Report variables or types that are declared or imported but never used.
🔧 Running with
--fixwill automatically remove all the reported errors.Fail
Success
Exception
To avoid resorting to weird workarounds that are sometimes used in internal interactive examples, the rule won't report values assigned to
_if a direct call toDebug.logis assigned to it.If you enable the
NoDebug.Logrule from thejfmengels/elm-review-debugpackage, and configure it to ignore the locations where it's acceptable, then the combination of both rules will make sure to clean up code like the above in all the other locations.Try it out
You can try this rule out by running the following command: