no-redeclare-with-import-autofix.rst (898B)
1 no-redeclare-with-import-autofix 2 ================================ 3 4 This is the 5 `builtin eslint rule no-redeclare <https://eslint.org/docs/latest/rules/no-redeclare>`_, 6 but with an additional fixer that can automatically remove superfluous 7 (duplicate) imports. 8 9 For redeclarations that are not imports, there is no automatic fix, as 10 the author will likely have to rename variables so that they do not 11 redeclare existing variables or conflict with the name of a builtin 12 property or global variable. 13 14 Typical duplicate imports happen when a `head.js` file, imports 15 a module and a test then subsequently also attempts to import the same 16 module. 17 18 In browser mochitests, an additional typical scenario is importing 19 modules that are already imported in the main browser window. Because 20 these tests run in a scope that inherits from the main browser window 21 one, there is no need to re-import such modules.