sindresorhus/eslint-plugin-unicorn
View on GitHubRule proposal: `no-duplicate-loops`
Open
#846 opened on Sep 30, 2020
help wantednew rule
Description
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')
}
}