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

Inspections can detect jQuery if the jQuery collection was stored in a member variable

Open stof opened this issue 6 years ago • 3 comments
trafficstars

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 ?

stof avatar Mar 04 '19 10:03 stof

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.

Berkmann18 avatar Apr 03 '19 10:04 Berkmann18

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.

stof avatar Apr 03 '19 14:04 stof

Note that we have fixed this issue our maintained fork: https://github.com/wikimedia/eslint-plugin-no-jquery/blob/master/rules/utils.js#L32

edg2s avatar Jun 28 '19 18:06 edg2s