tor-browser

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

reject-eager-module-in-lazy-getter.rst (734B)


      1 reject-eager-module-in-lazy-getter
      2 ==================================
      3 
      4 Rejects defining a lazy getter for module that's known to be loaded early in the
      5 startup process and it is not necessary to lazy load it.
      6 
      7 Examples of incorrect code for this rule:
      8 -----------------------------------------
      9 
     10 .. code-block:: js
     11 
     12    ChromeUtils.defineESModuleGetters(lazy, {
     13      AppConstants: "resource://gre/modules/AppConstants.sys.mjs",
     14    });
     15 
     16 Examples of correct code for this rule:
     17 ---------------------------------------
     18 
     19 .. code-block:: js
     20 
     21    import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
     22    const { AppConstants } = ChromeUtils.importESModule(
     23      "resource://gre/modules/AppConstants.sys.mjs"
     24    );