Page MenuHomePhabricator

Replace jQuery functions with native equivalents
Open, MediumPublic

Description

With integration of eslint's jquery plugin on horizon for eslint-config-wikimedia, we should take action and replace jQuery functions with native equivalents where useful:

Followed @Jdrewniak's take for MobileFrontend/MinervaNeue presenting reports in T100254#4678253, providing the same here, very generally for now.

Event Timeline

Change 468467 had a related patch set uploaded (by VolkerE; owner: VolkerE):
[oojs/ui@master] [DNM] Add eslint-detailed-reporter and eslint-plugin-jquery

https://gerrit.wikimedia.org/r/468467

I agree, we should follow eslint-config-wikimedia on what jQuery functions are allowed, which is what the above patch did.

with native equivalents where possible

I have a problem with this definition, which also what the original eslint-plugin-jquery package originally claimed to do ("Disallow jQuery functions with native equivalents.") because every jQuery function has a native equivalent of varying complexity.

That said there may be performance benefits to OOUI using a more aggressive superset of the jQuery rules.

I agree, we should follow eslint-config-wikimedia on what jQuery functions are allowed, which is what the above patch did.
[…]
That said there may be performance benefits to OOUI using a more aggressive superset of the jQuery rules.

This is what I feel like we should be doing in this task (and sub-tasks) as well. I personally don't care if such aggressive rules live in eslint-config-wikimedia (whenever possible and useful across all our products codebase) or in OOUI's .eslintrc.json – but I don't feel like we've done this to a reasonable optimum yet…?!

Volker_E triaged this task as Medium priority.Feb 2 2019, 12:10 AM

Change 468467 abandoned by VolkerE:
[DNM] Add eslint-detailed-reporter

Reason:
Can be re-actived if we decide to go deeper.

https://gerrit.wikimedia.org/r/468467