0.0.1 • Published 1 year ago

eslint-plugin-no-assignment-in-array-methods v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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"); // ✅
0.0.1

1 year ago