I\'ve recently added the eslint rule no-param-reassign.
However, when I use reduce to build out an object (empty object as initialValue
), I find myself need
Well, you could do (result, item) => Object.assign({}, result, {[item]: whatever})
to create a new object on every iteration :-)
If you want to trick the linter, you could use => Object.assign(result, {[item]: whatever})
(which does the same as your current code but without an explicit assignment), but yeah I guess you should simply disable that rule.