tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

use-static-import.rst (701B)


      1 use-static-import
      2 =================
      3 
      4 Requires the use of static imports in system ES module files (``.sys.mjs``)
      5 where possible.
      6 
      7 Examples of incorrect code for this rule:
      8 -----------------------------------------
      9 
     10 .. code-block:: js
     11 
     12    const { XPCOMUtils } = ChromeUtils.importESModule("resource://gre/modules/XPCOMUtils.sys.mjs");
     13    const { XPCOMUtils: foo } = ChromeUtils.importESModule("resource://gre/modules/XPCOMUtils.sys.mjs");
     14 
     15 Examples of correct code for this rule:
     16 ---------------------------------------
     17 
     18 .. code-block:: js
     19 
     20    import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
     21    import { XPCOMUtils as foo } from "resource://gre/modules/XPCOMUtils.sys.mjs";