eslint-plugin-no-assignment-in-array-methods
v0.0.1
Published
Force some array functions to avoid assignment
Downloads
5
Readme
eslint-plugin-no-assignment-in-array-methods
eslint-plugin-no-assignment-in-array-methods
Why
Performing assignment instead of comparison can be a tough bug to catch. This plugin seeks to prevent this class of bug, at least in the code areas where automated detection is possible
Example
const people = [{ name: "Alice" }, { name: "Bob" }, { name: "Charlie" }];
const bob = people.find((person) => (person.name = "Bob")); // ❌
const bob = people.find((person) => person.name === "Bob"); // ✅