From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../eslint-plugin-mozilla/avoid-Date-timing.rst | 30 +++++++++ .../eslint-plugin-mozilla/avoid-removeChild.rst | 20 ++++++ .../eslint-plugin-mozilla/balanced-listeners.rst | 20 ++++++ .../eslint-plugin-mozilla/balanced-observers.rst | 20 ++++++ .../consistent-if-bracing.rst | 23 +++++++ .../linters/eslint-plugin-mozilla/environment.rst | 76 ++++++++++++++++++++++ .../import-browser-window-globals.rst | 8 +++ .../import-content-task-globals.rst | 14 ++++ .../eslint-plugin-mozilla/import-globals-from.rst | 18 +++++ .../eslint-plugin-mozilla/import-globals.rst | 5 ++ .../import-headjs-globals.rst | 27 ++++++++ .../lazy-getter-object-name.rst | 25 +++++++ .../mark-exported-symbols-as-used.rst | 23 +++++++ .../mark-test-function-used.rst | 8 +++ .../linters/eslint-plugin-mozilla/no-aArgs.rst | 22 +++++++ .../eslint-plugin-mozilla/no-addtask-setup.rst | 27 ++++++++ .../no-arbitrary-setTimeout.rst | 23 +++++++ .../no-compare-against-boolean-literals.rst | 23 +++++++ .../eslint-plugin-mozilla/no-cu-reportError.rst | 23 +++++++ .../eslint-plugin-mozilla/no-define-cc-etc.rst | 23 +++++++ .../eslint-plugin-mozilla/no-throw-cr-literal.rst | 38 +++++++++++ .../no-useless-parameters.rst | 26 ++++++++ .../no-useless-removeEventListener.rst | 20 ++++++ .../eslint-plugin-mozilla/no-useless-run-test.rst | 6 ++ .../prefer-boolean-length-check.rst | 24 +++++++ .../eslint-plugin-mozilla/prefer-formatValues.rst | 23 +++++++ .../eslint-plugin-mozilla/reject-addtask-only.rst | 6 ++ .../reject-chromeutils-import-params.rst | 22 +++++++ .../reject-eager-module-in-lazy-getter.rst | 35 ++++++++++ .../eslint-plugin-mozilla/reject-global-this.rst | 29 +++++++++ .../reject-globalThis-modification.rst | 19 ++++++ ...reject-import-system-module-from-non-system.rst | 36 ++++++++++ .../reject-importGlobalProperties.rst | 45 +++++++++++++ .../reject-lazy-imports-into-globals.rst | 33 ++++++++++ .../reject-mixing-eager-and-lazy.rst | 22 +++++++ .../reject-multiple-getters-calls.rst | 27 ++++++++ .../eslint-plugin-mozilla/reject-osfile.rst | 13 ++++ .../reject-relative-requires.rst | 22 +++++++ .../reject-requires-await.rst | 20 ++++++ .../reject-scriptableunicodeconverter.rst | 13 ++++ .../eslint-plugin-mozilla/reject-some-requires.rst | 6 ++ .../reject-top-level-await.rst | 26 ++++++++ .../linters/eslint-plugin-mozilla/use-cc-etc.rst | 26 ++++++++ .../use-chromeutils-generateqi.rst | 33 ++++++++++ .../use-chromeutils-import.rst | 24 +++++++ .../use-default-preference-values.rst | 19 ++++++ .../use-includes-instead-of-indexOf.rst | 21 ++++++ .../eslint-plugin-mozilla/use-isInstance.rst | 42 ++++++++++++ .../eslint-plugin-mozilla/use-ownerGlobal.rst | 20 ++++++ .../eslint-plugin-mozilla/use-returnValue.rst | 20 ++++++ .../linters/eslint-plugin-mozilla/use-services.rst | 21 ++++++ .../eslint-plugin-mozilla/use-static-import.rst | 21 ++++++ .../eslint-plugin-mozilla/valid-ci-uses.rst | 42 ++++++++++++ .../linters/eslint-plugin-mozilla/valid-lazy.rst | 55 ++++++++++++++++ .../valid-services-property.rst | 30 +++++++++ .../eslint-plugin-mozilla/valid-services.rst | 24 +++++++ .../var-only-at-top-level.rst | 21 ++++++ 57 files changed, 1388 insertions(+) create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/avoid-Date-timing.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/avoid-removeChild.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/balanced-listeners.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/balanced-observers.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/consistent-if-bracing.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/environment.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/import-browser-window-globals.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/import-content-task-globals.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/import-globals-from.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/import-globals.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/import-headjs-globals.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/lazy-getter-object-name.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/mark-exported-symbols-as-used.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/mark-test-function-used.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/no-aArgs.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/no-addtask-setup.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/no-arbitrary-setTimeout.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/no-compare-against-boolean-literals.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/no-cu-reportError.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/no-define-cc-etc.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/no-throw-cr-literal.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/no-useless-parameters.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/no-useless-removeEventListener.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/no-useless-run-test.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/prefer-boolean-length-check.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/prefer-formatValues.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-addtask-only.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-chromeutils-import-params.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-eager-module-in-lazy-getter.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-global-this.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-globalThis-modification.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-import-system-module-from-non-system.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-importGlobalProperties.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-lazy-imports-into-globals.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-mixing-eager-and-lazy.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-multiple-getters-calls.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-osfile.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-relative-requires.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-requires-await.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-scriptableunicodeconverter.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-some-requires.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-top-level-await.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/use-cc-etc.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/use-chromeutils-generateqi.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/use-chromeutils-import.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/use-default-preference-values.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/use-includes-instead-of-indexOf.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/use-isInstance.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/use-ownerGlobal.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/use-returnValue.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/use-services.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/use-static-import.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/valid-ci-uses.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/valid-lazy.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/valid-services-property.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/valid-services.rst create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/var-only-at-top-level.rst (limited to 'docs/code-quality/lint/linters/eslint-plugin-mozilla') diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/avoid-Date-timing.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/avoid-Date-timing.rst new file mode 100644 index 0000000000..b01b568a28 --- /dev/null +++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/avoid-Date-timing.rst @@ -0,0 +1,30 @@ +avoid-Date-timing +================= + +Rejects grabbing the current time via Date.now() or new Date() for timing +purposes when the less problematic performance.now() can be used instead. + +The performance.now() function returns milliseconds since page load. To +convert that to milliseconds since the epoch, use: + +.. code-block:: js + + performance.timing.navigationStart + performance.now() + +Often timing relative to the page load is adequate and that conversion may not +be necessary. + +Examples of incorrect code for this rule: +----------------------------------------- + +.. code-block:: js + + Date.now() + +Examples of correct code for this rule: +--------------------------------------- + +.. code-block:: js + + new Date('2017-07-11'); + performance.now() diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/avoid-removeChild.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/avoid-removeChild.rst new file mode 100644 index 0000000000..15ece94d0d --- /dev/null +++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/avoid-removeChild.rst @@ -0,0 +1,20 @@ +avoid-removeChild +================= + +Rejects using ``element.parentNode.removeChild(element)`` when ``element.remove()`` +can be used instead. + +Examples of incorrect code for this rule: +----------------------------------------- + +.. code-block:: js + + elt.parentNode.removeChild(elt); + +Examples of correct code for this rule: +--------------------------------------- + +.. code-block:: js + + elt.remove(); + elt.parentNode.removeChild(elt2); diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/balanced-listeners.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/balanced-listeners.rst new file mode 100644 index 0000000000..f53c11e7aa --- /dev/null +++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/balanced-listeners.rst @@ -0,0 +1,20 @@ +balanced-listeners +================== + +Checks that for every occurrence of 'addEventListener' or 'on' there is an +occurrence of 'removeEventListener' or 'off' with the same event name. + +Examples of incorrect code for this rule: +----------------------------------------- + +.. code-block:: js + + elt.addEventListener('click', handler, false); + +Examples of correct code for this rule: +--------------------------------------- + +.. code-block:: js + + elt.addEventListener('event', handler); + elt.removeEventListener('event', handler); diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/balanced-observers.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/balanced-observers.rst new file mode 100644 index 0000000000..b169a520a3 --- /dev/null +++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/balanced-observers.rst @@ -0,0 +1,20 @@ +balanced-observers +================== + +Checks that for every occurrence of ``addObserver`` there is an +occurrence of ``removeObserver`` with the same topic. + +Examples of incorrect code for this rule: +----------------------------------------- + +.. code-block:: js + + Services.obs.addObserver(observer, 'observable'); + +Examples of correct code for this rule: +--------------------------------------- + +.. code-block:: js + + Services.obs.addObserver(observer, 'observable'); + Services.obs.removeObserver(observer, 'observable'); diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/consistent-if-bracing.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/consistent-if-bracing.rst new file mode 100644 index 0000000000..7bf6b796ef --- /dev/null +++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/consistent-if-bracing.rst @@ -0,0 +1,23 @@ +consistent-if-bracing +===================== + +Checks that if/elseif/else bodies are braced consistently, so either all bodies +are braced or unbraced. Doesn't enforce either of those styles though. + +Examples of incorrect code for this rule: +----------------------------------------- + +.. code-block:: js + + if (true) {1} else 0 + if (true) 1; else {0} + if (true) {1} else if (true) 2; else {0} + +Examples of correct code for this rule: +--------------------------------------- + +.. code-block:: js + + if (true) {1} else {0} + if (false) 1; else 0 + if (true) {1} else if (true) {2} else {0} diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/environment.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/environment.rst new file mode 100644 index 0000000000..2c779410d6 --- /dev/null +++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/environment.rst @@ -0,0 +1,76 @@ +Environment +=========== + +These environments are available by specifying a comment at the top of the file, +e.g. + +.. code-block:: js + + /* eslint-env mozilla/chrome-worker */ + +There are also built-in ESLint environments available as well. Find them here: http://eslint.org/docs/user-guide/configuring#specifying-environments + +browser-window +-------------- + +Defines the environment for scripts that are in the main browser.xhtml scope. + +chrome-script +------------- + +Defines the environment for scripts loaded by +``SpecialPowers.loadChromeScript``. + +chrome-worker +------------- + +Defines the environment for chrome workers. This differs from normal workers by +the fact that `ctypes` can be accessed as well. + +frame-script +------------ + +Defines the environment for scripts loaded by ``Services.mm.loadFrameScript``. + +jsm +--- + +Defines the environment for jsm files (javascript modules). + +privileged +---------- + +Defines the environment for privileged JS files. + +process-script +-------------- + +Defines the environment for scripts loaded by +``Services.ppmm.loadProcessScript``. + +remote-page +----------- + +Defines the environment for scripts loaded with ``