jfmengels/eslint-plugin-fp
View on GitHubRule proposal: no-functions-without-parameters
Open
#7 opened on Aug 28, 2016
enhancementhelp wantedquestion
Repository metrics
- Stars
- (968 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
Rule proposal: Forbid functions that do not take parameters.
Functions that do not take parameters are either
- using
argumentsto do some odd behavior. There is a different rule for that, but still - has side-causes : uses variables besides closure variables or parameters
- always return the same value: The function call could be replaced by the value itself.
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 :)