sindresorhus/eslint-plugin-unicorn
Support check `.unshift()` in `no-array-push-push`
Closed
#1,019 opened on Jan 14, 2021
enhancementhelp wanted
Repository metrics
- Stars
- (5,022 stars)
- PR merge metrics
- (Avg merge 1d 16h) (399 merged PRs in 30d)
Description
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