Often no-for-loop
results in something that could be simplified down to usage of Array.prototype.map()
This is an alternative to #1714 and only one of these rules should be implemented.
I would only allow this rule to match only "simple" for..of
cases as in these examples.
const result = []
for (const element of array) {
result.push(transform(element))
}
const result = []
for (const [index, element] of array.entries()) {
result[index] = transform(element)
}
const result = []
for (const [index, element] of array.entries()) {
result.push(anotherArray[index](element))
}
const result = array.map((element) => transform(element))
const result = array.map((element, index) => anotherArray[index](element))
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too