Closed
Bug 1395426
Opened 8 years ago
Closed 5 months ago
Eslint globals reference doesn't work for bug 1349689 (cyclic dependencies with import-globals-from)
Categories
(Developer Infrastructure :: Lint and Formatting, enhancement, P2)
Tracking
(firefox144 fixed)
RESOLVED
FIXED
144 Branch
| Tracking | Status | |
|---|---|---|
| firefox144 | --- | fixed |
People
(Reporter: rickychien, Assigned: standard8)
References
Details
Attachments
(2 files)
I'm seeing eslint throwing no-undef errors at [1], it's really weird and these globals (DownloadUtils, LoadContextInfo) should be detected and included by our Mozilla eslint tool.
This is more likely an issue in our custom eslint configuration.
In order to not block bug 1349689, bug 1349689 is going to add following workaround
/* globals DownloadUtils, LoadContextInfo */
on the top of browser/components/preferences/in-content/privacy.js.
Note that we should have a follow-up patch to get rid of above workaround once eslint issue gets fixed.
stardard8, would you like to take at look of this? Thanks
[1] https://treeherder.mozilla.org/#/jobs?repo=try&revision=1c8995dd9ce7&selectedJob=127034426
Flags: needinfo?(standard8)
| Assignee | ||
Comment 1•8 years ago
|
||
Found the issue - we have a cache when loading globals from other files to save having to re-parse each time.
Due to our lovely cyclic interdependencies between js files (I've a feeling preferences/ is one of the worst), we have a stop-gap to avoid circular dependencies causing eslint to go in a loop - but that isn't working quite right in this case:
If you trigger something that loads globals for a.js -> b.js -> a.js, then the second call to get globals for 'a.js' returns early (empty), so 'b.js' caches its own globals without the ones for 'a.js'. Then when you hit b.js later, the globals are wrong.
In the case of this bug we saw that running:
./mach eslint browser/components/preferences
would trigger the bug, but
./mach eslint browser/components/preferences/in-content/
would not trigger it. That's all due to the order in which the files happen to get loaded.
We either need to get the cache to not save it in the intermediate case (which might affect perf), or rewrite the cache mechanism (maybe store just the globals for the file itself, and which sub-files it references).
Given the changes needed I'll unlikely get to this before 57 branches, but given that we have the workaround via the 'global' comment, I think that is ok.
Flags: needinfo?(standard8)
Priority: -- → P2
Updated•7 years ago
|
Product: Testing → Firefox Build System
Updated•7 years ago
|
Version: Version 3 → 3 Branch
| Assignee | ||
Updated•4 years ago
|
Summary: Eslint globals reference doesn't work for bug 1349689 → Eslint globals reference doesn't work for bug 1349689 (cyclic dependencies with import-globals-from)
Updated•3 years ago
|
Product: Firefox Build System → Developer Infrastructure
Updated•3 years ago
|
Severity: normal → S3
| Assignee | ||
Comment 3•5 months ago
|
||
Updated•5 months ago
|
Assignee: nobody → standard8
Status: NEW → ASSIGNED
| Assignee | ||
Comment 4•5 months ago
|
||
This avoids calling the more generic Expression statement all the time, and simplifies processing of the node objects.
Pushed by mbanner@mozilla.com:
https://github.com/mozilla-firefox/firefox/commit/a4955e751219
https://hg.mozilla.org/integration/autoland/rev/fc47fe4e363f
When determining globals for ESLint, handle circular dependencies correctly. r=frontend-codestyle-reviewers,Gijs
https://github.com/mozilla-firefox/firefox/commit/1222b6e0050e
https://hg.mozilla.org/integration/autoland/rev/eefdcb69e220
Inline AssignmentExpression and CallExpression handlers in eslint-plugin-mozilla globals.mjs. r=frontend-codestyle-reviewers,Gijs
Comment 6•5 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/fc47fe4e363f
https://hg.mozilla.org/mozilla-central/rev/eefdcb69e220
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
status-firefox144:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 144 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•