eslint-plugin-unicorn icon indicating copy to clipboard operation
eslint-plugin-unicorn copied to clipboard

Support check `.unshift()` in `no-array-push-push`

Open fisker opened this issue 4 years ago • 1 comments

no-array-push-push was added in #1015, only check .push(), opening a new issue to see if someone need this.

Fail

foo.unshift(1);
foo.unshift(2);

Pass

const length = foo.unshift(1);
foo.unshift(2);

Note: .unshift() is a little different, need change arguments order, and consider side effects in each call.(.push only consider side effect in second call).

Original issue #937

fisker avatar Jan 14 '21 10:01 fisker

Sounds good 👍

sindresorhus avatar Jul 20 '22 18:07 sindresorhus