sindresorhus/eslint-plugin-unicorn

Rule proposal: `prefer-unshift`

クローズ

#2,165 opened on 2023/07/06

 (2 件のコメント) (2 件のリアクション) (0 人の担当者)JavaScript (468 件のフォーク)user submission
help wantednew rule

Repository metrics

Stars
 (5,022 個のスター)
PR merge metrics
 (平均マージ 4h 30m) (30d で 26 merged PRs)

説明

Description

I see my newbine team member write following code when I code review:

 sItems.splice(0, 0, { itemType: 'Ungroup' });

Fail

arr.splice(0, 0, {})

Pass

arr.unshift({})

Additional Info

maybe another proposal to suggest:

arr.splice(0, 1)

to:

arr.shift()

コントリビューターガイド