sindresorhus/eslint-plugin-unicorn

Rule proposal: `prefer-string-repeat`

Fermée

#1 774 ouverte le 30 mars 2022

 (3 commentaires) (5 réactions) (0 personne assignée)JavaScript (468 forks)user submission
help wantednew rule

Métriques du dépôt

Stars
 (5 022 étoiles)
Métriques de merge PR
 (Merge moyen 1j 16h) (399 PRs mergées en 30 j)

Description

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)

Guide contributeur