eslint-plugin-deprecate icon indicating copy to clipboard operation
eslint-plugin-deprecate copied to clipboard

deprecate/function always deprecates toString function name

Open carlansley opened this issue 4 years ago • 2 comments
trafficstars

This plugin incorrectly (I believe) always deprecates usage of the toString() function. Looking at the code in lib/rules/function.js, this is because funcs is initialized to the empty object {}, which has a toString method.

carlansley avatar Mar 01 '21 19:03 carlansley

One other thing: I haven't tested this, but I assume this issue affects other Object.prototype methods like valueOf, toLocaleString, etc.

carlansley avatar Mar 01 '21 19:03 carlansley

Hi @carlansley! Seems like a reasonable remark. In practice, I haven't expected this side effect while was using the function deprecation. But maybe using hasOwnProperty makes more sense here.

AlexMost avatar Mar 04 '21 08:03 AlexMost