Background
IP Info's JavaScript files (the files) are bundled in a ResourceLoader's package files module. We can leverage this to simplify/modernise those JavaScript files:
- Using module.exports and require() so that we don't need to attach code to the global mw object; and
- The files in a ResourceLoader package files module are delivered in their own closures, we can removing all IIFEs (Immediately Invoked Function Expressions) wrapping their contents. Ref T50886.
Further, we dropped the one-var rule from the Wikimedia's ESLint config in March (see https://github.com/wikimedia/eslint-config-wikimedia/issues/360 and https://wikimedia.slack.com/archives/C01CQ80JB6U/p1616012846006800 for additional discussion), which means that we can break up any big comma-separated var statements in the files too.
AC
- All IIFEs wrapping the contents of JavaScript files are removed
- The mw.IpInfo "namespace" (property) created in modules/ext.ipInfo/widget.js is deleted
- IPInfoWidget is exported from modules/ext.ipInfo/widget.js
- The */init.js files require the above to import IPInfoWidget
- Break up big comma-separated var statements wherever possible