Skip to content

Commit

Permalink
Add reduce spread article to no-array-reduce docs (#1400)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Jul 4, 2021
1 parent 1107455 commit 73d5188
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/rules/no-array-reduce.md
@@ -1,6 +1,6 @@
# Disallow `Array#reduce()` and `Array#reduceRight()`

`Array#reduce()` and `Array#reduceRight()` usually [result in hard-to-read code](https://twitter.com/jaffathecake/status/1213077702300852224). In almost every case, it can be replaced by `.map`, `.filter`, or a `for-of` loop. It's only somewhat useful in the rare case of summing up numbers.
`Array#reduce()` and `Array#reduceRight()` usually result in [hard-to-read](https://twitter.com/jaffathecake/status/1213077702300852224) and [less performant](https://www.richsnapp.com/article/2019/06-09-reduce-spread-anti-pattern) code. In almost every case, it can be replaced by `.map`, `.filter`, or a `for-of` loop. It's only somewhat useful in the rare case of summing up numbers.

Use `eslint-disable` comment if you really need to use it.

Expand Down

0 comments on commit 73d5188

Please sign in to comment.