Bug 1776837 - Part 2: Reject defining lazy getter for module that is already loaded eagerly at top-level. r=mossop
Depends on D150935 Differential Revision: https://phabricator.services.mozilla.com/D150936
This commit is contained in:
@@ -53,6 +53,7 @@ The plugin implements the following rules:
|
||||
eslint-plugin-mozilla/reject-global-this
|
||||
eslint-plugin-mozilla/reject-globalThis-modification
|
||||
eslint-plugin-mozilla/reject-importGlobalProperties
|
||||
eslint-plugin-mozilla/reject-mixing-eager-and-lazy
|
||||
eslint-plugin-mozilla/reject-osfile
|
||||
eslint-plugin-mozilla/reject-relative-requires
|
||||
eslint-plugin-mozilla/reject-requires-await
|
||||
|
||||
@@ -0,0 +1,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");
|
||||
Reference in New Issue
Block a user