sindresorhus/eslint-plugin-unicorn

Rule proposal: `prefer-unshift`

Chiusa

#2165 aperta il 6 lug 2023

 (2 commenti) (2 reazioni) (0 assegnatari)JavaScript (468 fork)user submission
help wantednew rule

Metriche repository

Star
 (5022 stelle)
Metriche merge PR
 (Merge medio 4h 30m) (26 PR mergiate in 30 g)

Descrizione

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()

Guida contributor