I have a method which's main purpose is to set a property on a DOM object
function (el) {
el.expando = {};
}
I use AirBnB's code style which makes ESLint throw a no-param-reassign
error:
error Assignment to function parameter 'el' no-param-reassign
How can I manipulate a DOM object passed as an argument while conforming AirBnB's code style?
Somebody suggested to use /* eslint react/prop-types: 0 */
referring to another issue but if I am not mistaken this applies well for react, but not for native DOM manipulation.
Also I do not think changing the code style is an answer. I believe one of the benefits of using a standard style is having consistent code across projects and changing the rules at will feels like a misuse of a major code style like AirBnB's.
For the record, I asked AirBnB on GitHub, what they think is the way to go in these cases in issue #766.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…