Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 745 Bytes

force-native-methods.md

File metadata and controls

37 lines (27 loc) · 745 Bytes

Forces the use of native methods instead of lodash/underscore

Many of the array functionality present in libraries like lodash.com or underscorejs.org are available on the Array prototype.

Rule Details

The following patterns are considered warnings:

import _ from 'lodash';

function getEvenNumbers(numbers) {
  return _.filter(numbers, num => num % 2 === 0);
}
import _ from 'lodash';

function increment(numbers) {
  return _.map(numbers, num => num + 1);
}

The following patterns are not considered warnings:

function getEvenNumbers(numbers) {
  return numbers.filter(num => num % 2 === 0);
}
function increment(numbers) {
  return numbers.map(num => num + 1);
}