Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sparksp/elm-review-forbidden-words

An elm-review rule to forbid certain words from comments and README.
https://github.com/sparksp/elm-review-forbidden-words

elm elm-review

Last synced: 8 days ago
JSON representation

An elm-review rule to forbid certain words from comments and README.

Awesome Lists containing this project

README

        

# elm-review-forbidden-words

![elm package](https://img.shields.io/elm-package/v/sparksp/elm-review-forbidden-words)
![elm-review 2.3](https://img.shields.io/badge/elm--review-2.3-%231293D8)
![elm 0.19](https://img.shields.io/badge/elm-0.19-%231293D8)
![Tests](https://github.com/sparksp/elm-review-forbidden-words/workflows/Tests/badge.svg)

Provides an [`elm-review`](https://package.elm-lang.org/packages/jfmengels/elm-review/latest/) rule to forbid certain words in Elm comments, README and elm.json.

## Example configuration

```elm
module ReviewConfig exposing (config)

import NoForbiddenWords
import Review.Rule exposing (Rule)

config : List Rule
config =
[ NoForbiddenWords.rule [ "TODO", "- [ ]" ]
]
```

Note: We search for the exact string that you enter, so if you're looking for "TODO" we won't report "todo".

## Failure Examples

Based on the configured words `"TODO"` and `"- [ ]"` the following examples would fail:

```elm
-- TODO: Finish writing this function
^^^^
-- [ ] Documentation
^^^^^
```

```elm
{- Actions
- [ ] Documentation
^^^^^
- [ ] Tests
^^^^^
-}
```

```json
{
"summary": "TODO write a summary",
^^^^
}
```

## Ignore README.md

You can easily ignore forbidden words in the README file like this:

```elm
import NoForbiddenWords
import Review.Rule exposing (Rule)

config : List Rule
config =
[ NoForbiddenWords.rule [ "TODO", "- [ ]" ]
|> Rule.ignoreErrorsForFiles [ "README.md" ]
]
```

## Try it out

You can try the example configuration above out by running the following command:

```bash
elm-review --template sparksp/elm-review-forbidden-words/example
```