Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 538 Bytes

prefer-immutable-method.md

File metadata and controls

30 lines (20 loc) · 538 Bytes

Prefer immutable methods

Prefer a method that doesn't mutate the arguments when available.

Rule Details

This rule takes no arguments

The following patterns are considered warnings:

_.pull(arr, value)
const a = _.remove(arr, fn);

The following patterns are not considered warnings:

const a = _.without(arr, value);
const a = _.filter(arr, fn);

When Not To Use It

If you do not want to enforce using methods that do not mutate the arguments when available, do not enable this rule.