jfmengels/elm-review-simplify

Detect when numbers cancel each other out in expression

Open

#123 opened on 2023年8月15日

GitHub で見る
 (0 comments) (1 reaction) (0 assignees)Elm (10 forks)github user discovery
enhancementhelp wanted

Repository metrics

Stars
 (22 stars)
PR merge metrics
 (PR metrics pending)

説明

This would be a follow-up to the idea in #41 and the PR done in #122.

The rule currently reports the following:

n - n
--> 0

-n + n
--> 0

but it doesn't catch something like this

something + n + else - n -- notice the 2 n cancel each other out
--> something + else

This would be nice to have, and I think that this will catch more problems than n - n.

Just like n - n, this simplification should not be enabled when we the rule is configured with expectNaN.

コントリビューターガイド