Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 809 Bytes

no-argumentless-calls.md

File metadata and controls

30 lines (23 loc) · 809 Bytes

Forbid argument-less calls of Lodash methods

Almost all lodash/fp methods should not be called without arguments. When used in composition constructs, it is an easy mistake to pass an argument-less call, instead of the method directly.

Some methods are ignored by this rule, as they can or are meant to be called without arguments: _.uniqueId, _.now, _.noConflict, _.runInContext.

Fail

_.flow(
  _.map(fn1),
  _.filter(fn2),
  _.flatten() // <-- Should not have been called
)(array);

Pass

_.flow(
  _.map(fn1),
  _.filter(fn2),
  _.flatten
)(array);