sindresorhus/eslint-plugin-unicorn
Rule proposal: `no-duplicate-loops`
Chiusa
#846 aperta il 30 set 2020
help wantednew rule
Metriche repository
- Star
- (5022 stelle)
- Metriche merge PR
- (Merge medio 1g 16h) (399 PR mergiate in 30 g)
Descrizione
I've seen this a couple of times
Error
for (const gamma of bars.map(alpha => alpha.beta.gamma)) {
gamma('ray')
}
for (const act of actions.filter(act => typeof act === 'function')) {
act('a fool')
}
Pass
for (const alpha of bars) {
alpha.beta.gamma('ray')
}
for (const act of actions) {
if (typeof act === 'function') {
act('a fool')
}
}