sindresorhus/eslint-plugin-unicorn

Rule proposal: `prefer-string-repeat`

已关闭

#1,774 创建于 2022年3月30日

 (3 条评论) (5 个反应) (0 位负责人)JavaScript (468 个派生)user submission
help wantednew rule

仓库指标

星标
 (5,022 个星标)
PR 合并指标
 (平均合并 1天 16小时) (30 天内合并 399 个 PR)

描述

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)

贡献者指南