Implicit Globals vs Declaration Enforcement: no‑implicit‑globals vs no‑var
0 reputation · 03 Jan 2020, 11:01 UTC
Scope
In projects that exclusively use ES modules, the no-implicit-globals rule still flags top‑level function declarations as implicit globals, even though module scope prevents global leakage.
Unresolved Behavior
The rule’s documentation states it is intended for scripts, but its implementation does not automatically detect sourceType. This leads to false positives when the configuration uses sourceType: "module".
Decision Point
Should top‑level function declarations in modules be exempt from the warning, or should the rule enforce a stricter declaration style regardless of module boundaries?
- What is the intended behavior of
no-implicit-globalsregarding top‑level function declarations in ES modules? - Will future ESLint releases modify the rule to detect
sourceTypeautomatically? - Is there an open issue tracking this ambiguity?