codidact / qpixel

Q&A-based community knowledge-sharing software
https://codidact.com
GNU Affero General Public License v3.0
388 stars 68 forks source link

Code style: discuss removing dependency on jQuery #1429

Open trichoplax opened 1 week ago

trichoplax commented 1 week ago

If there is consensus among the team, I'd like to see jQuery removed from the codebase. I'm raising this issue so people can discuss and add reasons for or against.

trichoplax commented 1 week ago

My reasons for preferring native JS over jQuery:

Oaphi commented 1 week ago

Seconding the motion. There are also reliability concerns as we have to wait until (and if it is available at all in the first place) it's available before we are able to make any JS-based actions. In addition, we have to ensure that it is loaded on each and every page. Moreover, strictly typing our JS assets (not necessarily via TypeScript - we already have a lot typed with JSDoc), which would've prevented at least several production-facing bugs already, requires making the developer environment aware of jQ, which is is not as straightforward with our codebase.

ArtOfCode- commented 1 week ago

I think I agree in principle. A lot has moved on from a few years ago when we last had this discussion and I was on the fence.

My main remaining concern would be browser compatibility; jQ provides us guaranteed compatibility based on the version we use; browser API support can vary and there may well be places we need to add fallback logic, which I dislike. Is that worth removing the dependency? On balance, probably.

I'll start a branch/PR to remove jQuery. Contributions welcome.

cellio commented 6 days ago

I'll leave setting priority to @ArtOfCode- .