summaryrefslogtreecommitdiffstats
path: root/tools/lint/eslint/eslint-plugin-mozilla/lib
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /tools/lint/eslint/eslint-plugin-mozilla/lib
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-upstream/125.0.1.tar.xz
firefox-upstream/125.0.1.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/lint/eslint/eslint-plugin-mozilla/lib')
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js15
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js1
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/configs/general-test.js17
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js60
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js11
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/environments/privileged.js1
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/environments/sysmjs.js (renamed from tools/lint/eslint/eslint-plugin-mozilla/lib/environments/jsm.js)8
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js2
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js8
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/index.js4
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-browser-window-globals.js2
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-content-task-globals.js6
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-headjs-globals.js2
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/rules/mark-exported-symbols-as-used.js4
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/rules/no-more-globals.js69
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-globalThis-modification.js2
-rw-r--r--tools/lint/eslint/eslint-plugin-mozilla/lib/services.json3
17 files changed, 162 insertions, 53 deletions
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js
index 08747a3f88..f21cd8d15a 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js
@@ -57,6 +57,19 @@ module.exports = {
waitForFocus: false,
},
+ overrides: [
+ {
+ // Some directories have multiple kinds of tests, and some rules
+ // don't work well for plain mochitests, so disable those.
+ files: ["*.html", "*.xhtml"],
+ // plain/chrome mochitests don't automatically include Assert, so
+ // autofixing `ok()` to Assert.something is bad.
+ rules: {
+ "mozilla/no-comparison-or-assignment-inside-ok": "off",
+ },
+ },
+ ],
+
plugins: ["mozilla", "@microsoft/sdl"],
rules: {
@@ -66,6 +79,7 @@ module.exports = {
{
exceptions: [
"^http:\\/\\/mochi\\.test?.*",
+ "^http:\\/\\/mochi\\.xorigin-test?.*",
"^http:\\/\\/localhost?.*",
"^http:\\/\\/127\\.0\\.0\\.1?.*",
// Exempt xmlns urls
@@ -83,6 +97,7 @@ module.exports = {
"mozilla/mark-test-function-used": "error",
"mozilla/no-addtask-setup": "error",
"mozilla/no-arbitrary-setTimeout": "error",
+ "mozilla/no-comparison-or-assignment-inside-ok": "error",
"mozilla/no-redeclare-with-import-autofix": [
"error",
{ errorForNonImports: false },
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js
index 3b5bbc06e2..a236118909 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js
@@ -39,6 +39,7 @@ module.exports = {
{
exceptions: [
"^http:\\/\\/mochi\\.test?.*",
+ "^http:\\/\\/mochi\\.xorigin-test?.*",
"^http:\\/\\/localhost?.*",
"^http:\\/\\/127\\.0\\.0\\.1?.*",
// Exempt xmlns urls
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/general-test.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/general-test.js
new file mode 100644
index 0000000000..2ed45ff621
--- /dev/null
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/general-test.js
@@ -0,0 +1,17 @@
+// Parent config file for all xpcshell files.
+"use strict";
+
+module.exports = {
+ rules: {
+ "mozilla/import-headjs-globals": "error",
+ "mozilla/mark-test-function-used": "error",
+ "mozilla/no-arbitrary-setTimeout": "error",
+
+ // Bug 1883707 - Turn off no-console in tests at the moment.
+ "no-console": "off",
+ // Turn off no-unsanitized for tests, as we do want to be able to use
+ // these for testing.
+ "no-unsanitized/method": "off",
+ "no-unsanitized/property": "off",
+ },
+};
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
index db7a0dc731..c4d28594b5 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
@@ -18,6 +18,14 @@
* require-atomic-updates - bug 1551829.
* - This generates too many false positives that are not easy to work
* around, and false positives seem to be inherent in the rule.
+ * no-inner-declarations - bug 1487642.
+ * - Would be interested if this could apply to just vars, but at the moment
+ * it doesn't.
+ * max-depth
+ * - Don't enforce the maximum depth that blocks can be nested. The
+ * complexity rule is a better rule to check this.
+ * no-useless-escape - bug 1881262.
+ * - This doesn't reveal any actual errors, and is a lot of work to address.
*/
module.exports = {
env: {
@@ -42,7 +50,7 @@ module.exports = {
// environment for them.
env: {
browser: false,
- "mozilla/jsm": true,
+ "mozilla/sysmjs": true,
},
files: ["**/*.sys.mjs", "**/*.jsm"],
rules: {
@@ -149,10 +157,6 @@ module.exports = {
// Functions must always return something or nothing
"consistent-return": "error",
- // XXX This rule line should be removed to enable it. See bug 1487642.
- // Require super() calls in constructors
- "constructor-super": "off",
-
// Require braces around blocks that start a new line
curly: ["error", "all"],
@@ -163,14 +167,6 @@ module.exports = {
// No credentials submitted with fetch calls
"fetch-options/no-fetch-credentials": "off",
- // XXX This rule line should be removed to enable it. See bug 1487642.
- // Enforce return statements in getters
- "getter-return": "off",
-
- // Don't enforce the maximum depth that blocks can be nested. The complexity
- // rule is a better rule to check this.
- "max-depth": "off",
-
// Maximum depth callbacks can be nested.
"max-nested-callbacks": ["error", 10],
@@ -212,28 +208,24 @@ module.exports = {
// Disallow use of arguments.caller or arguments.callee.
"no-caller": "error",
- // XXX Bug 1487642 - decide if we want to enable this or not.
- // Disallow lexical declarations in case clauses
- "no-case-declarations": "off",
-
- // XXX Bug 1487642 - decide if we want to enable this or not.
- // Disallow the use of console
- "no-console": "off",
+ // Disallow the use of console, except for errors and warnings.
+ "no-console": ["error", { allow: ["createInstance", "error", "warn"] }],
// Disallows expressions where the operation doesn't affect the value.
// TODO: This is enabled by default in ESLint's v9 recommended configuration.
"no-constant-binary-expression": "error",
- // XXX Bug 1487642 - decide if we want to enable this or not.
- // Disallow constant expressions in conditions
- "no-constant-condition": "off",
-
// If an if block ends with a return no need for an else block
"no-else-return": "error",
// No empty statements
"no-empty": ["error", { allowEmptyCatch: true }],
+ // Disallow empty static blocks.
+ // This rule will be a recommended rule in ESLint v9 so may be removed
+ // when we upgrade to that.
+ "no-empty-static-block": "error",
+
// Disallow eval and setInteral/setTimeout with strings
"no-eval": "error",
@@ -256,8 +248,7 @@ module.exports = {
// Disallow eval and setInteral/setTimeout with strings
"no-implied-eval": "error",
- // This has been superseded since we're using ES6.
- // Disallow variable or function declarations in nested blocks
+ // See explicit decisions at top of file.
"no-inner-declarations": "off",
// Disallow the use of the __iterator__ property
@@ -275,6 +266,11 @@ module.exports = {
// Nested ternary statements are confusing
"no-nested-ternary": "error",
+ // Disallow new operators with global non-constructor functions.
+ // This rule will be a recommended rule in ESLint v9 so may be removed
+ // when we upgrade to that.
+ "no-new-native-nonconstructor": "error",
+
// Disallow use of new wrappers
"no-new-wrappers": "error",
@@ -312,6 +308,11 @@ module.exports = {
"no-unsanitized/method": "error",
"no-unsanitized/property": "error",
+ // Disallow unused private class members.
+ // This rule will be a recommended rule in ESLint v9 so may be removed
+ // when we upgrade to that.
+ "no-unused-private-class-members": "error",
+
// No declaring variables that are never used
"no-unused-vars": [
"error",
@@ -331,8 +332,7 @@ module.exports = {
// lines)
"no-useless-concat": "error",
- // XXX Bug 1487642 - decide if we want to enable this or not.
- // Disallow unnecessary escape characters
+ // See explicit decisions at top of file.
"no-useless-escape": "off",
// Disallow redundant return statements
@@ -343,9 +343,5 @@ module.exports = {
// This may conflict with prettier, so turn it off.
"prefer-arrow-callback": "off",
-
- // XXX Bug 1487642 - decide if we want to enable this or not.
- // Require generator functions to contain yield
- "require-yield": "off",
},
};
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js
index 6a4d572911..d3c983999a 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js
@@ -10,6 +10,16 @@ module.exports = {
overrides: [
{
+ // Some directories have multiple kinds of tests, and some rules
+ // don't work well for plain mochitests, so disable those.
+ files: ["*.html", "*.xhtml"],
+ // plain/chrome mochitests don't automatically include Assert, so
+ // autofixing `ok()` to Assert.something is bad.
+ rules: {
+ "mozilla/no-comparison-or-assignment-inside-ok": "off",
+ },
+ },
+ {
// If it is a head file, we turn off global unused variable checks, as it
// would require searching the other test files to know if they are used or not.
// This would be expensive and slow, and it isn't worth it for head files.
@@ -44,6 +54,7 @@ module.exports = {
"mozilla/import-headjs-globals": "error",
"mozilla/mark-test-function-used": "error",
"mozilla/no-arbitrary-setTimeout": "error",
+ "mozilla/no-comparison-or-assignment-inside-ok": "error",
"mozilla/no-useless-run-test": "error",
"no-shadow": "error",
// Turn off no-unsanitized for tests, as we do want to be able to use
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/privileged.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/privileged.js
index c517de6209..7e6437ce7a 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/privileged.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/privileged.js
@@ -142,7 +142,6 @@ module.exports = {
DOMRect: false,
DOMRectList: false,
DOMRectReadOnly: false,
- DOMRequest: false,
DOMStringList: false,
DOMStringMap: false,
DOMTokenList: false,
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/jsm.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/sysmjs.js
index 30d8e0eb9c..03fe80e5c4 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/jsm.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/sysmjs.js
@@ -1,5 +1,5 @@
/**
- * @fileoverview Defines the environment for jsm files.
+ * @fileoverview Defines the environment for sys module files.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -10,7 +10,7 @@
module.exports = {
globals: {
- // These globals are hard-coded and available in .jsm scopes.
+ // These globals are hard-coded and available in .sys.mjs scopes.
// https://searchfox.org/mozilla-central/rev/dcb0cfb66e4ed3b9c7fbef1e80572426ff5f3c3a/js/xpconnect/loader/mozJSModuleLoader.cpp#222-223
// Although `debug` is allowed for jsm files, this is non-standard and something
// we don't want to allow in mjs files. Hence it is not included here.
@@ -18,8 +18,8 @@ module.exports = {
btoa: false,
dump: false,
// The WebAssembly global is available in most (if not all) contexts where
- // JS can run. It's definitely available in JSMs. So even if this is not
- // the perfect place to add it, it's not wrong, and we can move it later.
+ // JS can run. It's definitely available in system modules. So even if this
+ // is not the perfect place to add it, it's not wrong, and we can move it later.
WebAssembly: false,
},
};
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js
index 25c149fa9f..bbc1f9bed8 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js
@@ -634,7 +634,7 @@ module.exports = {
let globalScope;
let parser = {
- Program(node) {
+ Program() {
globalScope = context.getScope();
},
};
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
index dc4106631a..9ab51df37e 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
@@ -191,13 +191,13 @@ module.exports = {
let parents = [];
estraverse.traverse(ast, {
- enter(node, parent) {
+ enter(node) {
listener(node.type, node, parents);
parents.push(node);
},
- leave(node, parent) {
+ leave() {
if (!parents.length) {
throw new Error("Left more nodes than entered.");
}
@@ -285,7 +285,7 @@ module.exports = {
* @return {Object}
* Espree compatible permissive config.
*/
- getPermissiveConfig({ useBabel = true } = {}) {
+ getPermissiveConfig() {
return {
range: true,
loc: true,
@@ -511,7 +511,7 @@ module.exports = {
manifest,
});
} catch (e) {
- console.log(
+ console.error(
"TOML ERROR: " +
e.message +
" @line: " +
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js
index 0801958597..2ef516b526 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js
@@ -15,6 +15,7 @@ module.exports = {
configs: {
"browser-test": require("../lib/configs/browser-test"),
"chrome-test": require("../lib/configs/chrome-test"),
+ "general-test": require("../lib/configs/general-test"),
"mochitest-test": require("../lib/configs/mochitest-test"),
recommended: require("../lib/configs/recommended"),
"require-jsdoc": require("../lib/configs/require-jsdoc"),
@@ -26,7 +27,7 @@ module.exports = {
"chrome-script": require("../lib/environments/chrome-script.js"),
"chrome-worker": require("../lib/environments/chrome-worker.js"),
"frame-script": require("../lib/environments/frame-script.js"),
- jsm: require("../lib/environments/jsm.js"),
+ sysmjs: require("../lib/environments/sysmjs.js"),
privileged: require("../lib/environments/privileged.js"),
"process-script": require("../lib/environments/process-script.js"),
"remote-page": require("../lib/environments/remote-page.js"),
@@ -58,6 +59,7 @@ module.exports = {
"no-comparison-or-assignment-inside-ok": require("../lib/rules/no-comparison-or-assignment-inside-ok"),
"no-cu-reportError": require("../lib/rules/no-cu-reportError"),
"no-define-cc-etc": require("../lib/rules/no-define-cc-etc"),
+ "no-more-globals": require("../lib/rules/no-more-globals"),
"no-redeclare-with-import-autofix": require("../lib/rules/no-redeclare-with-import-autofix"),
"no-throw-cr-literal": require("../lib/rules/no-throw-cr-literal"),
"no-useless-parameters": require("../lib/rules/no-useless-parameters"),
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-browser-window-globals.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-browser-window-globals.js
index 7a099ba340..daa327f916 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-browser-window-globals.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-browser-window-globals.js
@@ -26,7 +26,7 @@ module.exports = {
create(context) {
return {
- Program(node) {
+ Program() {
let filePath = helpers.getAbsoluteFilePath(context);
let relativePath = path.relative(helpers.rootDir, filePath);
// We need to translate the path on Windows, due to the change
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-content-task-globals.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-content-task-globals.js
index e2b66ce8b0..c27ef25ce1 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-content-task-globals.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-content-task-globals.js
@@ -29,7 +29,7 @@ module.exports = {
create(context) {
return {
"CallExpression[callee.object.name='ContentTask'][callee.property.name='spawn']":
- function (node) {
+ function () {
// testing/mochitest/BrowserTestUtils/content/content-task.js
// This script is loaded as a sub script into a frame script.
for (let [name, value] of Object.entries(frameScriptEnv.globals)) {
@@ -37,7 +37,7 @@ module.exports = {
}
},
"CallExpression[callee.object.name='SpecialPowers'][callee.property.name='spawn']":
- function (node) {
+ function () {
for (let [name, value] of Object.entries(sandboxEnv.globals)) {
helpers.addVarToScope(name, context.getScope(), value);
}
@@ -54,7 +54,7 @@ module.exports = {
}
},
"CallExpression[callee.object.name='SpecialPowers'][callee.property.name='spawnChrome']":
- function (node) {
+ function () {
for (let [name, value] of Object.entries(sandboxEnv.globals)) {
helpers.addVarToScope(name, context.getScope(), value);
}
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-headjs-globals.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-headjs-globals.js
index d4fa484b99..0405d9cd78 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-headjs-globals.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-headjs-globals.js
@@ -13,7 +13,7 @@ var fs = require("fs");
var helpers = require("../helpers");
var globals = require("../globals");
-function importHead(context, path, node) {
+function importHead(context, path) {
try {
let stats = fs.statSync(path);
if (!stats.isFile()) {
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/mark-exported-symbols-as-used.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/mark-exported-symbols-as-used.js
index 5d0e57e4c8..3664374053 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/mark-exported-symbols-as-used.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/mark-exported-symbols-as-used.js
@@ -49,7 +49,7 @@ module.exports = {
create(context) {
return {
- AssignmentExpression(node, parents) {
+ AssignmentExpression(node) {
if (
node.operator === "=" &&
node.left.type === "MemberExpression" &&
@@ -61,7 +61,7 @@ module.exports = {
}
},
- VariableDeclaration(node, parents) {
+ VariableDeclaration(node) {
if (!isGlobalScope(context)) {
return;
}
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/no-more-globals.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/no-more-globals.js
new file mode 100644
index 0000000000..921ead67bd
--- /dev/null
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/no-more-globals.js
@@ -0,0 +1,69 @@
+/**
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+"use strict";
+
+const globals = require("../globals");
+
+const fs = require("fs");
+
+module.exports = {
+ meta: {
+ docs: {
+ url: "https://firefox-source-docs.mozilla.org/code-quality/lint/linters/eslint-plugin-mozilla/rules/no-more-globals.html",
+ },
+ messages: {
+ newGlobal:
+ "The global {{ name }} was not previously in this file, where new global variables are not permitted.",
+ removedGlobal:
+ "The global {{ name }} was expected to be defined in this file but isn't. Please remove it from the .globals file.",
+ missingGlobalsFile:
+ "This file has mozilla/no-more-globals enabled but has no .globals sibling file. Please create one.",
+ },
+ schema: [],
+ type: "problem",
+ },
+
+ create(context) {
+ return {
+ Program(node) {
+ let filename = context.filename;
+ let code = context.sourceCode.getText();
+ let currentGlobals = globals.getGlobalsForCode(code, {}, false);
+ let knownGlobals;
+ try {
+ knownGlobals = new Set(
+ JSON.parse(fs.readFileSync(filename + ".globals"))
+ );
+ } catch (ex) {
+ context.report({
+ node,
+ messageId: "missingGlobalsFile",
+ });
+ return;
+ }
+ for (let { name } of currentGlobals) {
+ if (!knownGlobals.has(name)) {
+ context.report({
+ node,
+ messageId: "newGlobal",
+ data: { name },
+ });
+ }
+ }
+ for (let known of knownGlobals) {
+ if (!currentGlobals.some(n => n.name == known)) {
+ context.report({
+ node,
+ messageId: "removedGlobal",
+ data: { name: known },
+ });
+ }
+ }
+ },
+ };
+ },
+};
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-globalThis-modification.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-globalThis-modification.js
index 13052db80c..f14fdcd795 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-globalThis-modification.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-globalThis-modification.js
@@ -42,7 +42,7 @@ module.exports = {
create(context) {
return {
- AssignmentExpression(node, parents) {
+ AssignmentExpression(node) {
let target = node.left;
while (target.type === "MemberExpression") {
target = target.object;
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/services.json b/tools/lint/eslint/eslint-plugin-mozilla/lib/services.json
index 476c6bf784..7077542fe8 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/services.json
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/services.json
@@ -16,9 +16,8 @@
"nsICookieService": "cookies",
"nsICrashReporter": "appinfo",
"nsIDAPTelemetry": "DAPTelemetry",
- "nsIDOMRequestService": "DOMRequest",
- "nsIDOMStorageManager": "domStorageManager",
"nsIDNSService": "dns",
+ "nsIDOMStorageManager": "domStorageManager",
"nsIDirectoryService": "dirsvc",
"nsIDroppedLinkHandler": "droppedLinkHandler",
"nsIEffectiveTLDService": "eTLD",