eslint-plugin-jquery
eslint-plugin-jquery copied to clipboard
Inspections can detect jQuery if the jQuery collection was stored in a member variable
Our existing jQuery-based code has some of cases where it uses this.$element to store a reference to a jQuery objects. Our convention is that any variable (or property of our object) with a name starting with $ contains a jQuery object.
Is there a way to make the plugin recognize those as jQuery usages ?
That's a great thing, the issue with this is that non-jQuery frameworks like VueJS, Angular (I think) use the $something pattern (usually as a property of a (global) variable) so this might get in the way, although I'm fairly sure it can be avoided.
well, making it configurable in the plugin (to require opting in for the more complete detection) would be fine with me. But I don't think this is possible currently.
Note that we have fixed this issue our maintained fork: https://github.com/wikimedia/eslint-plugin-no-jquery/blob/master/rules/utils.js#L32