Provides elm-review
rules to follow some of my personal code style preferences.
I tend to not have many rules related to code style thanks to using elm-format
and Elm's simple language,
and I think that elm-review
brings more values by reporting different kinds of issues than code style infringements,
but I do think that there are use-cases for it.
A few warnings before trying to add them to your review configuration.
-
These rules enforce opinions I personally have on "nicer" Elm code, and honestly they're mostly about resolving things I find relatively annoying. Do not enforce the ones you or your team disagrees with in your project.
-
These rules may be a source of more frustration (when the tests fails because of them) for your team and a source of work that will bring little value to your project. I try to provide fixes when I can to reduce that work though!
With that said, I recommend trying them out to help you decide.
- 🔧
NoRedundantlyQualifiedType
- Reports when a type is qualified by a module (alias) of the same name. - 🔧
NoSimpleLetBody
- Reports when a let expression's body is a simple reference to a value declared in the let expression. - 🔧
NoUnnecessaryTrailingUnderscore
- Reports unnecessary or suboptimal trailing underscores in variable names.
module ReviewConfig exposing (config)
import NoRedundantlyQualifiedType
import NoSimpleLetBody
import NoUnnecessaryTrailingUnderscore
import Review.Rule exposing (Rule)
config : List Rule
config =
[ NoUnnecessaryTrailingUnderscore.rule
, NoRedundantlyQualifiedType.rule
, NoSimpleLetBody.rule
]
You can try the example configuration above out by running the following command:
elm-review --template jfmengels/elm-review-code-style/example