This is a simple rule for the elm-review
tool that will flag the use of the Html.text
function as a mean to show nothing. It is quite often the case that we see the following pattern in elm code:
if a then
viewA a
else
text ""
However, there is the quite nice elm-community/html-extra
package that provide utility functions to "replace" those text ""
by an alias nothing
or by some other utility functions (e.g viewIf
, viewMaybe
, ...)
- if you've just installed
html-extra
on an already existing project chances are that you've plenty oftext ""
dispersed across many files. Setting up elm-review and using this rule would be a good way to find and fix them all. - if you are already got the habit of using the function from
html-extra
but you'd like to make sure that newcomers will get directed to the proper doc when they start on your project, this is also a good option.
- if you do not mind
text ""
in your code. - if you do not want to use
html-extra
. - if you do not want to setup
elm-review
. - ...
import NoEmptyText
import Review.Rule exposing (Rule)
config : List Rule
config =
[ NoEmptyText.rule
]