We're long overdue for a bump to the various JS libraries we use. In doing so, we should probably also modernize our frontend stack. This task documents various maintenance and clean up that can be done to get us out of being a "legacy" JS application.
- Include all assets in the repo itself, removing reliance on https://cdnjs.toolforge.org/. It's rare, but occasionally tools-static.wmflabs.org will go down and it causes all of XTools to go down with it.
- Can be locally stored in /assets/vendor/ for now, as opposed to using an NPM module
- Change our manually included vendor assets to use NPM modules
- We can ignore security warnings for dev-only packages for the time being, if it helps move this along
- n.b. https://symfony.com/doc/4.x/frontend/encore/legacy-applications.html
- Bump packages to stable, secure versions
- Stop using the global scope in our JS
- Likely very difficult to fix.
- Some Twig templates like globalContribs/result.html.twig pass data to the JS via the xtools global. We'll need to find a different means to give the client this server-generated data.
- Add ESLint
- Long-term we want our coding style to match MediaWiki conventions. The PHP side of that is a separate task, but if we add ESLint we should disable PHPCS on JS files and instead use https://github.com/wikimedia/eslint-config-wikimedia