Closed Bug 1812977 Opened 10 months ago Closed 10 months ago

Add handling of loadSubScript globals to ESLint

Categories

(Developer Infrastructure :: Lint and Formatting, task, P3)

Tracking

(firefox111 fixed)

RESOLVED FIXED
Tracking Status
firefox111 --- fixed

People

(Reporter: standard8, Assigned: standard8)

Details

Attachments

(8 files)

In a lot of places, we're doing things like:

/* import-globals-from ../shared-head.js */
Services.scriptloader.loadSubScript(
  "chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
  this
);

Since we know that chrome://mochitests/content/browser/ is effectively pointing to the base of the source tree, then in most instances we should be able to load the globals automatically without needing the import-globals-from.

For this, we will need to set these globals as non-explicit, so that the no-unused-vars rule doesn't pick them up in the case of only using not all of the globals that are imported.

Doing this will make it easier for developers and cut down the amount of extra comments in the code base.

Try push (although most of it is comments-only so it shouldn't affect things, but just in case...): https://treeherder.mozilla.org/jobs?repo=try&revision=fa3a5f6d10d1562396038d8da41ec2053088a8a1

This is a better location for these functions and helps avoid circular dependencies in the next patches.

Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bc28a70ceac6
Move ESLint functions for globals handling from helpers.js to globals.js. r=Gijs
https://hg.mozilla.org/integration/autoland/rev/3279fa5e3cfb
Add basic support for loadSubScript handling to ESLint. r=Gijs
https://hg.mozilla.org/integration/autoland/rev/3747e47fa4f2
Remove now unnecessary import-globals-from statements in accessible. r=Gijs
https://hg.mozilla.org/integration/autoland/rev/9c8083315f17
Remove now unnecessary import-globals-from statements in browser. r=settings-reviewers,mconley
https://hg.mozilla.org/integration/autoland/rev/c7d030abf4fb
Remove now unnecessary import-globals-from statements in devtools. r=Gijs
https://hg.mozilla.org/integration/autoland/rev/e67aa87d79c2
Remove now unnecessary import-globals-from statements in toolkit. r=Gijs,application-update-reviewers,credential-management-reviewers,sgalich,bytesized
https://hg.mozilla.org/integration/autoland/rev/3f4e3ed1e2b6
Remove now unnecessary import-globals-from statements in dom. r=Gijs,webdriver-reviewers,whimboo
https://hg.mozilla.org/integration/autoland/rev/4fa7cb10f64e
Remove now unnecessary import-globals-from statements in other directories. r=Gijs,webdriver-reviewers,whimboo
Regressions: 1813722
No longer regressions: 1813722
You need to log in before you can comment on or make changes to this bug.