How to avoid no-param-reassign when setting a property on a DOM object

As @Mathletics suggests, you can disable the rule entirely by adding this to your .eslintrc.json file:

"rules": {
  "no-param-reassign": 0
}

Or you can disable the rule specifically for param properties:

"rules": {
  "no-param-reassign": [2, { "props": false }]
}

Alternatively, you can disable the rule for that function:

/* eslint-disable no-param-reassign */
function (el) {
  el.expando = {};
}
/* eslint-enable no-param-reassign */

Or for a specific line only:

function (el) {
  el.expando = {}; // eslint-disable-line no-param-reassign
}

Leave a Comment