summaryrefslogtreecommitdiffstats
path: root/docs/code-quality/lint/linters/eslint-plugin-mozilla/use-static-import.rst
blob: 9090dd80b7c7d51b677cce44bb3038ba584ae78d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use-static-import
=================

Requires the use of static imports in system ES module files (``.sys.mjs``)
where possible.

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

.. code-block:: js

    const { XPCOMUtils } = ChromeUtils.importESModule("resource://gre/modules/XPCOMUtils.sys.mjs");
    const { XPCOMUtils: foo } = ChromeUtils.importESModule("resource://gre/modules/XPCOMUtils.sys.mjs");

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

.. code-block:: js

    import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
    import { XPCOMUtils as foo } from "resource://gre/modules/XPCOMUtils.sys.mjs";