summaryrefslogtreecommitdiffstats
path: root/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-mixing-eager-and-lazy.rst
blob: 1bf5100901741128785e0277605aca7ad2426c6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
reject-mixing-eager-and-lazy
==================================

Rejects defining a lazy getter for a module that's eagerly imported at
top-level script unconditionally.

Examples of incorrect code for this rule:
-----------------------------------------

.. code-block:: js

    const { SomeProp } = ChromeUtils.import("resource://gre/modules/Foo.jsm");
    XPCOMUtils.defineLazyModuleGetter(lazy, {
      OtherProp: "resource://gre/modules/Foo.jsm",
    });

Examples of correct code for this rule:
---------------------------------------

.. code-block:: js

    const { SomeProp, OtherProp } = ChromeUtils.import("resource://gre/modules/Foo.jsm");