---
source: crates/oxc_linter/src/tester.rs
expression: no_accumulating_spread
---
  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ Object.keys(obj).reduce((acc, key) => ({ ...acc, [key]: obj[key] }), {})
   ·                  ───┬──                  ───┬──
   ·                     │                       ╰── From this spread
   ·                     ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ Object.keys(obj).reduce((acc, key) => ({ ...acc, [key]: obj[key] }), ({} as foo))
   ·                  ───┬──                  ───┬──
   ·                     │                       ╰── From this spread
   ·                     ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ Object.keys(obj).reduce((acc, key) => ({ ...acc, [key]: obj[key] }), foo)
   ·                  ───┬──                  ───┬──
   ·                     │                       ╰── From this spread
   ·                     ╰── For this reduce
   ╰────
  help: Consider using `Object.assign()` or `Array.prototype.push()` to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ arr.reduce((acc, x) => ({ ...acc, [x]: x }), {})
   ·     ───┬──                ───┬──
   ·        │                     ╰── From this spread
   ·        ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ arr.reduce((differentName, x) => ({ ...differentName, [x]: x }), {})
   ·     ───┬──                          ────────┬───────
   ·        │                                    ╰── From this spread
   ·        ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ a.b.arr.reduce((acc, x) => ({ ...acc, [x]: x }), {})
   ·         ───┬──                ───┬──
   ·            │                     ╰── From this spread
   ·            ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ a.b.arr.reduce((acc, x) => ({ ...acc, [x]: x }), (({} as baz)))
   ·         ───┬──                ───┬──
   ·            │                     ╰── From this spread
   ·            ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ a.b.arr.reduce((acc, x) => ({ ...acc, [x]: x }), (({})))
   ·         ───┬──                ───┬──
   ·            │                     ╰── From this spread
   ·            ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ a.b.c.d.reduce((acc,x) => ([...acc, x]), [])
   ·         ───┬──              ───┬──
   ·            │                   ╰── From this spread
   ·            ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Array`. Consider using the `Array.push` or `Array.concat` methods to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ a.b.c.d.reduce((acc,x) => ([...acc, x]), ([]))
   ·         ───┬──              ───┬──
   ·            │                   ╰── From this spread
   ·            ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Array`. Consider using the `Array.push` or `Array.concat` methods to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ a.b.c.d.reduce((acc,x) => ([...acc, x]), ([] as foo))
   ·         ───┬──              ───┬──
   ·            │                   ╰── From this spread
   ·            ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Array`. Consider using the `Array.push` or `Array.concat` methods to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ a.b.c.d.reduce((acc,x) => ([...acc, x]), (([]) as foo))
   ·         ───┬──              ───┬──
   ·            │                   ╰── From this spread
   ·            ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Array`. Consider using the `Array.push` or `Array.concat` methods to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ get_array().reduce((acc, x) => ({ ...acc, [x]: x }), {})
   ·             ───┬──                ───┬──
   ·                │                     ╰── From this spread
   ·                ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ arr.reduce(function (acc, x) { return { ...acc, [x]: x } }, {})
   ·     ───┬──                              ───┬──
   ·        │                                   ╰── From this spread
   ·        ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ arr.reduce((acc, x) => {
   ·     ───┬──
   ·        ╰── For this reduce
 2 │             let temp = { ...acc, x }
   ·                          ───┬──
   ·                             ╰── From this spread
 3 │             return temp
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduce((acc, bar) => [...acc, bar], [])
   ·     ───┬──                ───┬──
   ·        │                     ╰── From this spread
   ·        ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Array`. Consider using the `Array.push` or `Array.concat` methods to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduceRight((acc, bar) => [...acc, bar], [])
   ·     ─────┬─────                ───┬──
   ·          │                        ╰── From this spread
   ·          ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Array`. Consider using the `Array.push` or `Array.concat` methods to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduce((acc, bar) => {return [...acc, bar];}, [])
   ·     ───┬──                        ───┬──
   ·        │                             ╰── From this spread
   ·        ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Array`. Consider using the `Array.push` or `Array.concat` methods to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduceRight((acc, bar) => {return [...acc, bar];}, [])
   ·     ─────┬─────                        ───┬──
   ·          │                                ╰── From this spread
   ·          ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Array`. Consider using the `Array.push` or `Array.concat` methods to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduce((acc, bar) => [...acc, ...bar], [])
   ·     ───┬──                ───┬──
   ·        │                     ╰── From this spread
   ·        ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Array`. Consider using the `Array.push` or `Array.concat` methods to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduceRight((acc, bar) => [...acc, ...bar], [])
   ·     ─────┬─────                ───┬──
   ·          │                        ╰── From this spread
   ·          ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Array`. Consider using the `Array.push` or `Array.concat` methods to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduce((acc, bar) => {return [...acc, ...bar];}, [])
   ·     ───┬──                        ───┬──
   ·        │                             ╰── From this spread
   ·        ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Array`. Consider using the `Array.push` or `Array.concat` methods to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduceRight((acc, bar) => {return [...acc, ...bar];}, [])
   ·     ─────┬─────                        ───┬──
   ·          │                                ╰── From this spread
   ·          ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Array`. Consider using the `Array.push` or `Array.concat` methods to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduce((acc, bar) => ({...acc, [bar.key]: bar.value}), {})
   ·     ───┬──                 ───┬──
   ·        │                      ╰── From this spread
   ·        ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduceRight((acc, bar) => ({...acc, [bar.key]: bar.value}), {})
   ·     ─────┬─────                 ───┬──
   ·          │                         ╰── From this spread
   ·          ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduce((acc, bar) => {return {...acc, [bar.key]: bar.value};}, {})
   ·     ───┬──                        ───┬──
   ·        │                             ╰── From this spread
   ·        ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduceRight((acc, bar) => {return {...acc, [bar.key]: bar.value};}, {})
   ·     ─────┬─────                        ───┬──
   ·          │                                ╰── From this spread
   ·          ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduce((acc, bar) => ({...acc, ...bar}), {})
   ·     ───┬──                 ───┬──
   ·        │                      ╰── From this spread
   ·        ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduceRight((acc, bar) => ({...acc, ...bar}), {})
   ·     ─────┬─────                 ───┬──
   ·          │                         ╰── From this spread
   ·          ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduce((acc, bar) => {return {...acc, ...bar};}, {})
   ·     ───┬──                        ───┬──
   ·        │                             ╰── From this spread
   ·        ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.

  ⚠ oxc(no-accumulating-spread): Do not spread accumulators in Array.prototype.reduce()
   ╭─[no_accumulating_spread.tsx:1:1]
 1 │ foo.reduceRight((acc, bar) => {return {...acc, ...bar};}, {})
   ·     ─────┬─────                        ───┬──
   ·          │                                ╰── From this spread
   ·          ╰── For this reduce
   ╰────
  help: It looks like you're spreading an `Object`. Consider using the `Object.assign` or assignment operators to mutate the accumulator instead.
        Using spreads within accumulators leads to `O(n^2)` time complexity.


