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

Rejects calls to require which use relative directories.

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

.. code-block:: js

    require("./relative/path")
    require("../parent/folder/path")
    loader.lazyRequireGetter(this, "path", "../parent/folder/path", true)

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

.. code-block:: js

    require("devtools/absolute/path")
    require("resource://gre/modules/SomeModule.jsm")
    loader.lazyRequireGetter(this, "path", "devtools/absolute/path", true)