summaryrefslogtreecommitdiffstats
path: root/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/reject-mixing-eager-and-lazy.rst
blob: 51524f4e1456bc343f098050a32e4b2ae60b6b52 (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");
    ChromeUtils.defineLazyModuleGetters(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");