sindresorhus/eslint-plugin-unicorn

Rule proposal: `prefer-string-repeat`

Open

#1,774 opened on 2022年3月30日

GitHub で見る
 (3 comments) (4 reactions) (0 assignees)JavaScript (5,022 stars) (468 forks)user submission
help wantednew rule

説明

Description

https://github.com/eslint/eslint/pull/15731#issuecomment-1082586113

Fail

Array.from({length: 10 + 1}).join('*')
Array.from({length: 10}).fill('*').join('')
Array.from({length: 10}, () => '*').join('')

Pass

'*'.repeat(10)
String(foo).repeat(10)

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