Be Careful with Array Mutators

Nicholas Jamieson
3 min readFeb 21, 2019
Photo by Corinne Kutz on Unsplash

A while ago, I wrote a linting rule to highlight an error that I’d made on a few occasions. Let’s look at the error — and its variations — and then at the rule that prevents it.

The error

If you are used to working with fluent APIs — perhaps with D3 or lodash — it feels natural to write Array-based code like this:

const developers = employees…

--

--

Nicholas Jamieson

RxJS core team member; front-end developer; mentor; speaker; open-source contributor