Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/truqu/elm-review-noredundantconcat
Provides an elm-review rule to prohibit redundant usage of `++`
https://github.com/truqu/elm-review-noredundantconcat
elm elm-review lint
Last synced: 19 days ago
JSON representation
Provides an elm-review rule to prohibit redundant usage of `++`
- Host: GitHub
- URL: https://github.com/truqu/elm-review-noredundantconcat
- Owner: truqu
- License: bsd-3-clause
- Created: 2020-05-17T08:00:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-10-12T10:14:34.000Z (about 2 years ago)
- Last Synced: 2024-05-08T23:40:44.725Z (8 months ago)
- Topics: elm, elm-review, lint
- Language: Elm
- Size: 28.3 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elm-review-noredundantconcat
Helps with preventing redundant usage of concatenation. Expressions like `[ a ]
++ b` can be rewritten as `a :: b`, and expressions like `[ a ] ++ [ b ]` could
be simply `[ a, b ]`.## Configuration
```elm
module ReviewConfig exposing (config)import NoRedundantConcat
import Review.Rule exposing (Rule)config : List Rule
config =
[ NoRedundantConcat.rule
]
```## Currently covered
- [x] Concatenating list literals with `++` (`[ foo ] ++ [ bar ] -> [ foo, bar ]`)
- [x] Concatenating a list literal with some other value (`[ foo ] ++ bar -> foo :: bar`)
- [x] Using `List.concat` with list literals (`List.concat [ [ foo ], [ bar ] ] -> [ foo, bar ]`)
- [x] Using `++` with `String` literals (`"foo" ++ "bar" -> "foobar"`)## Future work
- [ ] Using `List.append` with list literals
- [ ] Using `String.append` with string literals
- [ ] Using `String.concat` with string literals
- [ ] Using `String.join ""` over `String.concat`These all follow a common pattern of making the concatenation of literals more
complex than it has to be.