Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leojpod/review-no-empty-html-text
elm-review rule to forbid the use of `Html.text ""`
https://github.com/leojpod/review-no-empty-html-text
elm elm-community elm-review html-extra
Last synced: 2 days ago
JSON representation
elm-review rule to forbid the use of `Html.text ""`
- Host: GitHub
- URL: https://github.com/leojpod/review-no-empty-html-text
- Owner: leojpod
- License: mit
- Created: 2020-05-30T19:51:47.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-03T17:38:56.000Z (over 4 years ago)
- Last Synced: 2024-12-07T21:44:30.255Z (about 2 months ago)
- Topics: elm, elm-community, elm-review, html-extra
- Language: Elm
- Homepage:
- Size: 362 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# No-empty-html-text
## What is it?
This is a simple rule for the [`elm-review`](https://package.elm-lang.org/packages/jfmengels/elm-review/latest/) 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:
```elm
if a then
viewA a
else
text ""
```However, there is the quite nice [`elm-community/html-extra`](https://package.elm-lang.org/packages/elm-community/html-extra/latest/) package that provide utility functions to "replace" those `text ""` by an alias [`nothing`](https://package.elm-lang.org/packages/elm-community/html-extra/latest/Html-Extra#nothing) or by some other utility functions (e.g [`viewIf`](https://package.elm-lang.org/packages/elm-community/html-extra/latest/Html-Extra#viewIf), [`viewMaybe`](https://package.elm-lang.org/packages/elm-community/html-extra/latest/Html-Extra#viewMaybe), ...)
## Why should you use it?
- if you've just installed `html-extra` on an already existing project chances are that you've plenty of `text ""` 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.## Why should you not use it?
- 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`.
- ...## Example configuration
```elm
import NoEmptyText
import Review.Rule exposing (Rule)config : List Rule
config =
[ NoEmptyText.rule
]
```