If you aim for your project to avoid side-effects as much as possible, then you might want to forbid the of methods like _.forEach
, _.forIn
or _.forOwn
. By default, it will also report any call to methods named forEach
.
This rule supports the following options:
noNative
: If set to true
, then any method call of the form x.forEach()
will be reported, even if it's not a Lodash method. Default is true
.
You can set the options like this:
"lodash-fp/no-for-each": ["error", {"noNative": false}]
_.forEach(fn, array);
_.each(fn, array);
_.forIn(fn, array);
_.forOwn(fn, array);
_.forEachRight(fn, array);
_.eachRight(fn, array);
_.forInRight(fn, array);
_.forOwnRight(fn, array);
_.flow(
_.filter(fn1),
_.forEach(fn2)
);
array.forEach(fn);
_.flow(
_.filter(fn1),
_.map(fn2)
);
_.map(fn, array);
/* eslint lodash-fp/no-for-each: ["error", {"noNative": false}] */
array.forEach(fn);