Closed Bug 1772299 Opened 2 years ago Closed 2 years ago

Create an ESLint rule that disallows modification to the shared global, in system module

Categories

(Developer Infrastructure :: Lint and Formatting, task)

Tracking

(firefox103 fixed)

RESOLVED FIXED
103 Branch
Tracking Status
firefox103 --- fixed

People

(Reporter: arai, Assigned: arai)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Given global this is not available on ES module but globalThis is available there,
it lets people think globalThis can be an alternative for this.
But this is not true and any modification to globalThis is visible from all modules.

This is problematic especially in system module, given globalThis is the shared global, used by all system modules, both JSM and ESM.

Any modification to globalThis should be caught by ESLint rule, with clear description about why you shouldn't modify.

This includes:

  • globalThis.foo = ...
  • lazy getter definition on globalThis
  • Object.defineProperty etc
Assignee: nobody → arai.unmht
Attachment #9279400 - Attachment description: WIP: Bug 1772299 - Reject modification to globalThis inside system module. r?Standard8 → Bug 1772299 - Reject modification to globalThis inside system module. r?Standard8
Status: NEW → ASSIGNED
Attachment #9279400 - Attachment description: Bug 1772299 - Reject modification to globalThis inside system module. r?Standard8 → Bug 1772299 - Reject modification to globalThis inside system module. r?Standard8!
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/d56ee796ad0b
Reject modification to globalThis inside system module. r=Standard8,webdriver-reviewers,jdescottes
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 103 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: