Skip to content

Clean up ESLint globals

Currently we have 17 globals defined in .eslintrc, some of which could be covered by using env: {"browser": true}, some of which are made unnecessary by the .eslintrc override within our fixtures directory, and some of which are far too specific and should not be included here (i.e. Turbolinks, Mousetrap, etc).

For all GitLab-defined globals, we should place declarations within our script file headers like so:

/* global Turbolinks */

(function() {
  Turbolinks.visit("foo");
})();

This will make it easier to find where we are abusing global scope so we can eventually migrate away from this behavior.

Note: many files are exempted from needing a /* global ... */ declaration due to our use of /* eslint-disable no-undef */. We should also strive to remove these exemptions so that we can allow eslint to help us catch all abuses of the global scope within our frontend assets.

See also #20983 (closed)