eslint-plugin-ramda icon indicating copy to clipboard operation
eslint-plugin-ramda copied to clipboard

Don't declare and <-> or as complements

Open dawehner opened this issue 6 years ago • 3 comments

I tried to add nand as function to ramda-adjunct, see https://github.com/char0n/ramda-adjunct/issues/237. When I tried to do that, eslint-plugin-ramda complaint about complement(and) being replaceable by or.

This is strictly not true for one case:

R.or(false, false) -> false
R.complement(R.and(false, false)) -> true

Am I missing something?

dawehner avatar Jun 09 '19 05:06 dawehner

Actually, complement(and(false, false)) evaluates to [undefined]. Ideally, complement should receive a predicate function and in this case it is receiving a value (the result of and(false, false), which eslint-plugin-ramda will force to become false && false). I believe you mean complement(and)(false, false). If it is that case, you are correct.

In order to merge your pull-request, I'll only ask you to remove the specific test for it (which is breaking the build).

Thank you!

haskellcamargo avatar Jun 13 '19 05:06 haskellcamargo

Codecov Report

Merging #26 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #26   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          27     27           
  Lines         249    249           
=====================================
  Hits          249    249
Impacted Files Coverage Δ
rules/complement-simplification.js 100% <ø> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2e3d75d...3618c7b. Read the comment docs.

codecov-io avatar Jun 18 '19 07:06 codecov-io

Actually, complement(and(false, false)) evaluates to [undefined]. Ideally, complement should receive a predicate function and in this case it is receiving a value (the result of and(false, false), which eslint-plugin-ramda will force to become false && false). I believe you mean complement(and)(false, false). If it is that case, you are correct.

Oh, spot on. Thank you for pointing this out.

I've updated the test

dawehner avatar Jun 18 '19 07:06 dawehner