summaryrefslogtreecommitdiffstats
path: root/docs/code-quality/lint/linters/eslint-plugin-mozilla
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /docs/code-quality/lint/linters/eslint-plugin-mozilla
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/code-quality/lint/linters/eslint-plugin-mozilla')
-rw-r--r--docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/import-headjs-globals.rst1
-rw-r--r--docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/no-more-globals.rst20
-rw-r--r--docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/reject-mixing-eager-and-lazy.rst11
-rw-r--r--docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/reject-relative-requires.rst2
-rw-r--r--docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/valid-lazy.rst10
5 files changed, 33 insertions, 11 deletions
diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/import-headjs-globals.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/import-headjs-globals.rst
index df8ef81300..51ec8eeb62 100644
--- a/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/import-headjs-globals.rst
+++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/import-headjs-globals.rst
@@ -19,7 +19,6 @@ If path does not exist because it is generated e.g.
The following patterns are supported:
-- ``Cu.import("resource://devtools/client/shared/widgets/ViewHelpers.jsm");``
- ``loader.lazyRequireGetter(this, "name2"``
- ``loader.lazyServiceGetter(this, "name3"``
- ``loader.lazyGetter(this, "toolboxStrings"``
diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/no-more-globals.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/no-more-globals.rst
new file mode 100644
index 0000000000..2cbe7e82ab
--- /dev/null
+++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/no-more-globals.rst
@@ -0,0 +1,20 @@
+no-more-globals
+===============
+
+This rule is used to discourage people from adding ever more global variables to
+files where the rule is run.
+
+For any file ``example.js`` where the rule is applied, the rule will read
+an allowlist of globals from a sibling ``example.js.globals`` file. The rule
+will warn for any globals defined in ``example.js`` that are not listed in the
+``globals`` file, and will also warn for any items on the allowlist in
+the ``globals`` file that are no longer present in ``example.js``, encouraging
+people to remove them from the ``globals`` list.
+
+If you see errors from this rule about new globals, **do not just add items to
+the allowlist**. Instead, work to find a way to run your code so that it does
+not add to the list of globals.
+
+If you see errors when removing globals, simply remove them from the allowlist
+to make sure it is up-to-date and things do not inadvertently end up getting
+put back in.
diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/reject-mixing-eager-and-lazy.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/reject-mixing-eager-and-lazy.rst
index 51524f4e14..1b7c165036 100644
--- a/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/reject-mixing-eager-and-lazy.rst
+++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/reject-mixing-eager-and-lazy.rst
@@ -9,9 +9,10 @@ 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",
+ const { SomeProp } =
+ ChromeUtils.importESModule("resource://gre/modules/Foo.sys.mjs");
+ ChromeUtils.defineESModuleGetters(lazy, {
+ OtherProp: "resource://gre/modules/Foo.sys.mjs",
});
Examples of correct code for this rule:
@@ -19,4 +20,6 @@ Examples of correct code for this rule:
.. code-block:: js
- const { SomeProp, OtherProp } = ChromeUtils.import("resource://gre/modules/Foo.jsm");
+ const { SomeProp, OtherProp } = ChromeUtils.importESModule(
+ "resource://gre/modules/Foo.sys.mjs"
+ );
diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/reject-relative-requires.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/reject-relative-requires.rst
index 4387041b26..c3ec0cfed8 100644
--- a/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/reject-relative-requires.rst
+++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/reject-relative-requires.rst
@@ -18,5 +18,5 @@ Examples of correct code for this rule:
.. code-block:: js
require("devtools/absolute/path")
- require("resource://gre/modules/SomeModule.jsm")
+ require("resource://gre/modules/SomeModule.sys.mjs")
loader.lazyRequireGetter(this, "path", "devtools/absolute/path", true)
diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/valid-lazy.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/valid-lazy.rst
index a7edeeb5fc..e7f6706d5b 100644
--- a/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/valid-lazy.rst
+++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/valid-lazy.rst
@@ -19,10 +19,10 @@ Examples of incorrect code for this rule:
.. code-block:: js
const lazy = {};
- ChromeUtils.defineLazyGetter(lazy, "foo", "foo.jsm");
+ ChromeUtils.defineESModuleGetters(lazy, { foo: "foo.sys.mjs"});
// Duplicate symbol foo being added to lazy.
- ChromeUtils.defineLazyGetter(lazy, "foo", "foo1.jsm");
+ ChromeUtils.defineLazyGetter(lazy, "foo", () => {});
if (x) {
lazy.foo3.bar();
}
@@ -31,12 +31,12 @@ Examples of incorrect code for this rule:
const lazy = {};
// Unused lazy property foo
- ChromeUtils.defineLazyGetter(lazy, "foo", "foo.jsm");
+ ChromeUtils.defineESModuleGetters(lazy, { foo: "foo.sys.mjs"});
.. code-block:: js
const lazy = {};
- ChromeUtils.defineLazyGetter(lazy, "foo", "foo.jsm");
+ ChromeUtils.defineESModuleGetters(lazy, { foo: "foo.sys.mjs"});
// Used at top-level unconditionally.
lazy.foo.bar();
@@ -47,7 +47,7 @@ Examples of correct code for this rule:
const lazy = {};
ChromeUtils.defineLazyGetter(lazy, "foo1", () => {});
- XPCOMUtils.defineLazyModuleGetters(lazy, { foo2: "foo2.jsm" });
+ ChromeUtils.defineESModuleGetters(lazy, { foo2: "foo2.sys.mjs"});
if (x) {
lazy.foo1.bar();