Improve rule for $.toggle
the-stas opened this issue · 3 comments
On our project we usually prepend DOM related variables with double dollar sign "$$" for better readability and searchability. But in that case this "no-jquery" plugin show error for toggle method of classList.
https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#Methods
Something like this:
$$container.classList.toggle( SOME_CLASS );
and in console we have an error that toggle not allowed, but it is native JS method of classList property of DOM element.
I think it would be nice to improve the plugin to not detect classList.toggle() as jQuery.
Also I might try to fix it by myself with the help of some core devs :)
Thank you in advance!
Note that we have fixed this issue our maintained fork: https://github.com/wikimedia/eslint-plugin-no-jquery/blob/master/rules/utils.js#L32