jfmengels / eslint-plugin-fp

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

Rule proposal: no-functions-without-parameters #7

Open jfmengels opened 8 years ago

jfmengels commented 8 years ago

Rule proposal: Forbid functions that do not take parameters.

Functions that do not take parameters are either

I do wonder about methods that are not assigned, like for the following example

const count = values
  .map(() => 1)
  .reduce((a, b) => a + b, 0);

This should be allowed, and I think that having the function not be assigned and not declared on its own (i.e., passed as an expression) should be allowed, but I'm not sure whether this should be behind a flag or not.

If people are watching, would gladly get some feedback on this :)

cobaltt7 commented 2 years ago
     const count = values
      .map(() => 1)
      .reduce((a, b) => a + b, 0);

A better use case would be using .sort and Math.random to randomize an array like so: arr.sort(() => Math.random() - 0.5)