Add a lint rule that prevents adding more globals to browser.js
Categories
(Developer Infrastructure :: Lint and Formatting, task, P3)
Tracking
(firefox125 fixed)
Tracking | Status | |
---|---|---|
firefox125 | --- | fixed |
People
(Reporter: Gijs, Assigned: Gijs)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
bug 1880897 has some rationale.
There are some 200-odd globals listed in browser.js
.
The lint rule should:
- only apply to browser.js
- iterate over all the variable, function and class declarations in the global scope
- hold an allowlist of known identifier strings
- complain if the list in browser.js does not match its list (ie items removed from browser.js will need removing from the lint rule, and the lint rule will complain if the file has new globals that are not in its allowlist.
This probably seems like overkill. Unfortunately my experience with https://searchfox.org/mozilla-central/source/browser/base/content/test/general/browser.toml is that people are quite happy to submit patches that add items to a list even if every other line in the file tells them not to (in all caps, to boot), dutifully copying the warning line. Hopefully the linter will help...
Comment 1•9 months ago
|
||
We might be able to base something on or around the browser-window environment for ESLint.
We can already load that & generate a list of globals which we do for export purposes.
Assignee | ||
Updated•9 months ago
|
Assignee | ||
Comment 2•9 months ago
|
||
Comment 3•8 months ago
|
||
The severity field is not set for this bug.
:andi, could you have a look please?
For more information, please visit BugBot documentation.
Updated•8 months ago
|
Updated•8 months ago
|
Comment 5•8 months ago
|
||
bugherder |
Description
•