Skip to content
Commit 1fc9c6ac authored by Frank Tackitt's avatar Frank Tackitt
Browse files

Add elm-review rule NoConfusingPrefixOperator

This forbids the use of operators as functions, e.g. `Maybe.map ((>=) b) maybeA`
instead recommending `Maybe.map (\a -> a >= b) maybeA`

Personally, I find the use of operator prefixes easy to read, but they may be found confusing by newer elm users

```
-- ELM-REVIEW ERROR --------------- src/DesignSystem/Stories/DataList.elm:242:24

NoConfusingPrefixOperator: Found a confusing usage of prefix operator

241|             in
242|             Maybe.map ((>=) createdAt) startAt
                            ^^^^
243|                 |> Maybe.withDefault True

Prefix operators for operators like this one are very error-prone. While `a >=
b` is easy to understand, it is not as obvious to a reader that `(>=) b` is the
same as `\a -> b >= a`.

Prefer using the form `\b -> a >= b` which will be a lot easier to understand
and to get right.
```
parent b728f9aa
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment