Closed Bug 1352969 Opened 7 years ago Closed 7 years ago

[ESLint] Improve detection of globals from browser-window environment and start resolving no-undef issues in browser/base

Categories

(Firefox :: General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 55
Tracking Status
firefox55 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(2 files)

I've had this patch set for a while now locally, and I think it is time to land it.

Currently it leaves about 100 no-undef issues in browser/base, which I'll deal with in a follow-up.

There's two main parts to this:

1) Improve global detection for browser-window:

- Get the browser-window environment to pull in everything from places-overlay environment, since browser-window is a superset of places-overlay.
- Automatically inject the browser-window global environment into scripts that are part of the browser-window scope.

2) Various fixes and imports for reducing no-undef errors in the browser/base directory.
Comment on attachment 8853916 [details]
Bug 1352969 - Fix various ESLint no-undef issues in browser/base (no-undef is not enabled yet).

https://reviewboard.mozilla.org/r/125938/#review128912

Tiring work I'm sure, thanks for doing all this.
Attachment #8853916 - Flags: review?(dtownsend) → review+
Comment on attachment 8853917 [details]
Bug 1352969 - Improve ESLint environment browser-window globals list, and automatically inject it into browser-window scripts.

https://reviewboard.mozilla.org/r/125940/#review128914

::: tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js:117
(Diff revision 1)
> -  var globalObjects = {};
> +  // placesOverlay.xul is also included in the browser scope, so include
> +  // those globals here.
> +  var globalObjects = placesGlobals;
>    for (let global of fileGlobals) {
>      globalObjects[global.name] = global.writable;
>    }

I think you might be overwriting the globals in places-overlay here. Better to use Object.assign to get a clones object you can manipulate freely.
Attachment #8853917 - Flags: review?(dtownsend) → review+
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/23b17c071b03
Fix various ESLint no-undef issues in browser/base (no-undef is not enabled yet). r=mossop
https://hg.mozilla.org/integration/autoland/rev/a7d64bc0d974
Improve ESLint environment browser-window globals list, and automatically inject it into browser-window scripts. r=mossop
https://hg.mozilla.org/mozilla-central/rev/23b17c071b03
https://hg.mozilla.org/mozilla-central/rev/a7d64bc0d974
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: