Closed jfmengels closed 8 years ago
Decided not to forbid calling valueOf
explicitly in this rule. Let me know if someone thinks that should be a new rule.
@bodil This rule was just added in v2.2.0. Just a heads up in case you'd like to remove it from cleanjs.
No, I like it. :)
Rule proposal: Forbid specifying a
valueOf
field in an object.Having
valueOf
overriden for an object, or any value, can cause some unexpected, or simply implicit behavior.Invalid
Valid
I'm wondering whether this should also check for
X.prototype.valueOf = ...
,X.valueOf = ...
. I'm not sure as it's already kind of covered byno-mutation
, and I'd prefer not to create 2 errors for it. I still think it should (and then the name should be changed, probably tono-valueof
) as people can turn on this rule and notno-mutation
.And that brings another question, should
no-valueof
then also forbid callingvalueOf
explicitly?If people are watching, would gladly get some feedback on this :)