Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 621 Bytes

reject-globalThis-modification.rst

File metadata and controls

19 lines (14 loc) · 621 Bytes

reject-globalThis-modification

Reject any modification to globalThis inside the system modules.

globalThis is the shared global inside the system modules, and modification on it is visible from all modules, and it shouldn't be done unless it's really necessary.

Examples of incorrect code for this rule:

globalThis.foo = 10;
Object.defineProperty(globalThis, "bar", { value: 20});
ChromeUtils.defineESModuleGetters(globalThis, {
  AppConstants: "resource://gre/modules/AppConstants.sys.mjs",
});