jfmengels / eslint-plugin-fp

ESLint rules for functional programming
MIT License
970 stars 36 forks source link

Add more options for `no-unused-expression` rule #27

Open tunnckoCore opened 7 years ago

tunnckoCore commented 7 years ago

Currently, i almost don't see how it can be used, even in FP. It's true that i'm not so fully FP, not so hardcore FP, but it fails for simple things like asserting. Isn't it too aggressive?

Can you should some "real" examples that may pass that rule? It's pretty cool and i like it, mostly.

graingert commented 7 years ago

@charlike instead of assertions you need to use the Validation applicative functor.

const result = validation.bind(function(val) {
    if (val == "hi") {
        return Validation.success("world")
    } else {
        return Validation.fail("wow, you really failed.")
    }
});

It's true that i'm not so fully FP, not so hardcore FP

then this rule-set is not for you.