wikimedia / eslint-plugin-no-jquery

Control allowance of certain jQuery functions, and suggest or autofix alternatives.
MIT License
31 stars 8 forks source link

$.filter does not have a -util version #141

Closed Paril closed 5 years ago

Paril commented 5 years ago

I'm looking to get rid of the utility functions, and $.filter seems to be the odd one out. $('a').filter('.some_class') is a fairly valid/often-used pattern, and as far as I can tell $.filter as a "util" function doesn't even exist. The documentation is a bit wrong on this one.

edg2s commented 5 years ago

$.filter is not documented but it does exist and is used internally by $.fn.filter. I can't imagine a situation where you'd want to disable the filter method but not the util (or vice versa).

Ideally every rule built by createCollectionOrUtilMethodRule would be separated into two rules, but we have prioritised the rules where the filter is functionally different from the method.

Paril commented 5 years ago

You're right, I think I just misread something and must have thought it was replaceable in my usages!