When using _.filter with an identity or boolean casting , it could improve readability by switching to _.compact
This rule takes no arguments.
The following patterns are considered warnings:
_(arr).map(f).filter(function(x) {return x}),
_.filter(arr, function(x) { return !!x})
The following patterns are not considered warnings:
var x = _.filter(arr, function(x) {return !x.a && p});
var x = _.filter(arr, function(x) {return f(x) || g(x)});
var x = _.compact(arr);
If you do not want to enforce using _.compact
, you should not use this rule.