Hello,
The eslint `no-redeclare` rule flags up duplicate globals in JS. Unfortunately it can't do anything to fix issues, and our window environments in JS are... a little complex, so it isn't enabled on most of the tree.
However, over in bug
1795255 I've landed a patch that takes that builtin rule and
builds on top of it to flag up unnecessary `ChromeUtils.import`
calls, and enabled it for browser test files. It will auto-fix to
remove imports that you don't need (e.g. TestUtils,
BrowserTestUtils, etc.). This removed some 700-odd lines of
imports we didn't need.
Right now it isn't turned on outside of browser tests, and also
doesn't flag up non-imports, as that hits lots of other conflicts
like `let URL = "mytestpage";` (which conflicts with the global
DOM `URL` constructor).
Going forward we'll do some automated rewriting of some of those issues and then work to turn on that part of the rule (which can't auto-fix - you'll need to rename variables!) for browser tests too.
Finally, if you hit a problem where this rule flags up imports that you definitely do need (either because the eslint environment is confused about what globals are/aren't available, or because the module name conflicts with a DOM global) you can use
```
// eslint-disable-next-line
mozilla/no-redeclare-with-import-autofix
```
to stop it complaining.
Thanks,
Gijs