Closed
Bug 1429024
Opened 8 years ago
Closed 8 years ago
eslint doesn't detect defined lazy preference getters outside of the global scope
Categories
(Developer Infrastructure :: Lint and Formatting, enhancement)
Developer Infrastructure
Lint and Formatting
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: Gijs, Unassigned)
Details
In https://reviewboard.mozilla.org/r/211292/diff/1#index_header I'm adding a pref getter for `gDebuggingEnabled` on the global `this`, and using it a few lines later, which for some reason fails the "no-undef" rule in eslint. It shouldn't do that. I assume we have plugins that could be modified to take care of this.
Comment 1•8 years ago
|
||
We do detect lazy getters and define globals for those, however we only do it when they are in the global scope:
https://searchfox.org/mozilla-central/rev/cf149b7b63ff97023e28723167725e38cf5df757/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js#293
I think one of the reasons that we don't do non-global scope is that it is actually quite hard without turning into a static analyser. For example, you're using `XPCOMUtils.defineLazyPreferenceGetter(this, ...);` but ESLint won't know what `this` is unless we get it to walk back up the stack. For your case we could do that, but there's still plenty of cases where we can't (e.g. function with `this` as global scope, but that hasn't been called directly).
Since gDebuggingEnabled is defined on the global this, why not put the lazy getter in the global scope anyway?
| Reporter | ||
Comment 2•8 years ago
|
||
(In reply to Mark Banner (:standard8) from comment #1)
> Since gDebuggingEnabled is defined on the global this, why not put the lazy
> getter in the global scope anyway?
D'oh. Yeah, I can do that. I guess that means this is wontfix as filed.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
| Reporter | ||
Updated•8 years ago
|
Summary: eslint doesn't detect defined lazy preference getters → eslint doesn't detect defined lazy preference getters outside of the global scope
Updated•8 years ago
|
Product: Testing → Firefox Build System
Updated•3 years ago
|
Product: Firefox Build System → Developer Infrastructure
You need to log in
before you can comment on or make changes to this bug.
Description
•