Open NovemLinguae opened 6 months ago
Should this instead be a new https://github.com/wikimedia/eslint-plugin-no-jquery rule? @edg2s, thoughts?
It would probably make sense to add the rules to the plugin, although they will be quite distinct from other rules, in that the apply to neither the $
global object, or a $collection
. That said "done" and "fail" are quite uncommon names for methods outside of promises.
Using jQuery's .done() or .fail() instead of native JS promises .then() or catch():
1) contradicts the advice at https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Asynchronous_code
2) led to some nasty bugs in one repo I was working with, for example, this patch
I'd suggest adding something like the below to our jQuery rules. Code below credit Kosta Harlan.