`const` and `let` have sane scoping behavior and the latter allows for read-only assignments. `var` does not and must go.
Replace all `var` usages with `const` or, if necessary, `let`. Consider documenting, automating, or semi-automating the task to resolve merge conflicts due to lingering code review and helping other repos, such as MinervaNeue, migrate in the future. [[ https://eslint.org/docs/rules/prefer-const | `prefer-const` ]] has an autofixer and may help the effort.
[[ https://eslint.org/docs/rules/one-var | `one-var` ]] is a useful lint to avoid hoisting issues. However, these issues are not present with `const`, `let`, or ES6 functions and greatly deteriorate readability. As part of this task, disable `one-var` as it is for Popups and limit the scope of variables as much as practical.
== Acceptance criteria
[] All occurrences of `var` are replaced in src, tests, and even webpack.config.js.
[] Using `let` or `var` where `const` can be used should cause the linter to fail.
[] Any changes to ESLint config should be attempted in [[ https://github.com/wikimedia/eslint-config-wikimedia | eslint-config-wikimedia ]].
[] No regressions to production or tests.