From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- .../lib/configs/recommended.js | 11 +- .../lib/configs/xpcshell-test.js | 4 +- .../lib/environments/browser-window.js | 1 + .../eslint/eslint-plugin-mozilla/lib/globals.js | 12 +- .../eslint/eslint-plugin-mozilla/lib/helpers.js | 34 +++ .../lib/rules/mark-exported-symbols-as-used.js | 20 +- .../lib/rules/reject-global-this.js | 2 +- .../lib/rules/reject-mixing-eager-and-lazy.js | 2 +- .../lib/rules/reject-multiple-getters-calls.js | 18 ++ .../lib/rules/reject-top-level-await.js | 4 +- .../lib/rules/use-isInstance.js | 3 +- .../lib/rules/use-static-import.js | 2 +- .../eslint-plugin-mozilla/lib/rules/valid-lazy.js | 2 +- .../lint/eslint/eslint-plugin-mozilla/manifest.tt | 4 +- .../eslint/eslint-plugin-mozilla/package-lock.json | 312 +++++++++++++-------- .../lint/eslint/eslint-plugin-mozilla/package.json | 3 +- .../tests/reject-multiple-getters-calls.js | 16 ++ .../lib/environments/self-hosted.js | 3 +- tools/lint/eslint/manifest.tt | 4 +- 19 files changed, 315 insertions(+), 142 deletions(-) (limited to 'tools/lint/eslint') 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 c4d28594b5..036ed1bda3 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js @@ -55,6 +55,7 @@ module.exports = { files: ["**/*.sys.mjs", "**/*.jsm"], rules: { "mozilla/lazy-getter-object-name": "error", + "mozilla/reject-chromeutils-import": "error", "mozilla/reject-eager-module-in-lazy-getter": "error", "mozilla/reject-global-this": "error", "mozilla/reject-globalThis-modification": "error", @@ -76,7 +77,7 @@ module.exports = { "no-unused-vars": [ "error", { - args: "none", + argsIgnorePattern: "^_", vars: "all", }, ], @@ -142,7 +143,7 @@ module.exports = { }, // When adding items to this file please check for effects on sub-directories. - plugins: ["fetch-options", "html", "json", "no-unsanitized"], + plugins: ["html", "json", "no-unsanitized"], // When adding items to this file please check for effects on all of toolkit // and browser @@ -163,10 +164,6 @@ module.exports = { // Encourage the use of dot notation whenever possible. "dot-notation": "error", - // XXX This rule should be enabled, see Bug 1557040 - // No credentials submitted with fetch calls - "fetch-options/no-fetch-credentials": "off", - // Maximum depth callbacks can be nested. "max-nested-callbacks": ["error", 10], @@ -317,7 +314,7 @@ module.exports = { "no-unused-vars": [ "error", { - args: "none", + argsIgnorePattern: "^_", vars: "local", }, ], 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 d3c983999a..7701a0b2ca 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 @@ -29,7 +29,7 @@ module.exports = { "no-unused-vars": [ "error", { - args: "none", + argsIgnorePattern: "^_", vars: "local", }, ], @@ -42,7 +42,7 @@ module.exports = { "no-unused-vars": [ "error", { - args: "none", + argsIgnorePattern: "^_", vars: "all", }, ], diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js index 241299e2d3..83fa01935e 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js @@ -57,6 +57,7 @@ const MAPPINGS = { "browser/components/places/content/places-menupopup.js", "shopping-sidebar.js": "browser/components/shopping/content/shopping-sidebar.js", + "browser-sidebar.js": "browser/components/sidebar/browser-sidebar.js", }; const globalScriptsRegExp = diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js index bbc1f9bed8..4d894b58cf 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js @@ -634,8 +634,8 @@ module.exports = { let globalScope; let parser = { - Program() { - globalScope = context.getScope(); + Program(node) { + globalScope = helpers.getScope(context, node); }, }; let filename = context.getFilename(); @@ -651,10 +651,14 @@ module.exports = { for (let type of Object.keys(GlobalsForNode.prototype)) { parser[type] = function (node) { if (type === "Program") { - globalScope = context.getScope(); + globalScope = helpers.getScope(context, node); helpers.addGlobals(extraHTMLGlobals, globalScope); } - let globals = handler[type](node, context.getAncestors(), globalScope); + let globals = handler[type]( + node, + helpers.getAncestors(context, node), + globalScope + ); helpers.addGlobals( globals, globalScope, diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js index 9ab51df37e..7d44b4b1b3 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js @@ -794,4 +794,38 @@ module.exports = { } return null; }, + + /** + * Gets the scope for a node taking account of where the scope function + * is available (supports node versions earlier than 8.37.0). + * + * @param {object} context + * The context passed from ESLint. + * @param {object} node + * The node to get the scope for. + * returns {function} + * The getScope function object. + */ + getScope(context, node) { + return context.sourceCode?.getScope + ? context.sourceCode.getScope(node) + : context.getScope(); + }, + + /** + * Gets the ancestors for a node taking account of where the ancestors function + * is available (supports node versions earlier than 8.38.0). + * + * @param {object} context + * The context passed from ESLint. + * @param {object} node + * The node to get the scope for. + * returns {function} + * The getScope function object. + */ + getAncestors(context, node) { + return context.sourceCode?.getAncestors + ? context.sourceCode.getAncestors(node) + : context.getAncestors(); + }, }; 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 3664374053..b632e3b632 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 @@ -19,16 +19,26 @@ function markArrayElementsAsUsed(context, node, expression) { } for (let element of expression.elements) { - context.markVariableAsUsed(element.value); + context.markVariableAsUsed + ? context.markVariableAsUsed(element.value) + : context.sourceCode.markVariableAsUsed(element.value); } // Also mark EXPORTED_SYMBOLS as used. - context.markVariableAsUsed("EXPORTED_SYMBOLS"); + context.markVariableAsUsed + ? context.markVariableAsUsed("EXPORTED_SYMBOLS") + : context.sourceCode.markVariableAsUsed("EXPORTED_SYMBOLS"); } // Ignore assignments not in the global scope, e.g. where special module // definitions are required due to having different ways of importing files, // e.g. osfile. -function isGlobalScope(context) { +function isGlobalScope(context, node) { + if (context.sourceCode?.getScope) { + let upper = context.sourceCode.getScope(node).upper; + // ESLint v9 uses a global scope object with type = "global". Earlier + // versions use a null upper scope. + return !upper || upper.type == "global"; + } return !context.getScope().upper; } @@ -55,14 +65,14 @@ module.exports = { node.left.type === "MemberExpression" && node.left.object.type === "ThisExpression" && node.left.property.name === "EXPORTED_SYMBOLS" && - isGlobalScope(context) + isGlobalScope(context, node) ) { markArrayElementsAsUsed(context, node, node.right); } }, VariableDeclaration(node) { - if (!isGlobalScope(context)) { + if (!isGlobalScope(context, node)) { return; } diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-global-this.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-global-this.js index ec4b5fd43d..1067a4befa 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-global-this.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-global-this.js @@ -29,7 +29,7 @@ module.exports = { create(context) { return { ThisExpression(node) { - if (!helpers.getIsGlobalThis(context.getAncestors())) { + if (!helpers.getIsGlobalThis(helpers.getAncestors(context, node))) { return; } diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-mixing-eager-and-lazy.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-mixing-eager-and-lazy.js index 5779a90afd..41ddc998a3 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-mixing-eager-and-lazy.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-mixing-eager-and-lazy.js @@ -71,7 +71,7 @@ module.exports = { (callerSource === "ChromeUtils.import" || callerSource === "ChromeUtils.importESModule") && helpers.getIsTopLevelAndUnconditionallyExecuted( - context.getAncestors() + helpers.getAncestors(context, node) ) ) { if (node.arguments.length < 1) { diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-multiple-getters-calls.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-multiple-getters-calls.js index e6e37ad035..0e0f6e2e17 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-multiple-getters-calls.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-multiple-getters-calls.js @@ -56,6 +56,24 @@ module.exports = { return; } + if (node.arguments.length >= 3) { + const options = node.arguments[2]; + let globalOption = null; + if (options.type == "ObjectExpression") { + for (const prop of options.properties) { + if ( + prop.type == "Property" && + isIdentifier(prop.key, "global") + ) { + globalOption = helpers.getASTSource(prop.value); + } + } + } + if (globalOption) { + target += "+" + globalOption; + } + } + const parent = stmt.parent; let targets; if (parentToTargets.has(parent)) { diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-top-level-await.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-top-level-await.js index dff7db0f9a..7356fe10bf 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-top-level-await.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-top-level-await.js @@ -26,7 +26,7 @@ module.exports = { create(context) { return { AwaitExpression(node) { - if (!helpers.getIsTopLevelScript(context.getAncestors())) { + if (!helpers.getIsTopLevelScript(helpers.getAncestors(context, node))) { return; } context.report({ node, messageId: "rejectTopLevelAwait" }); @@ -34,7 +34,7 @@ module.exports = { ForOfStatement(node) { if ( !node.await || - !helpers.getIsTopLevelScript(context.getAncestors()) + !helpers.getIsTopLevelScript(helpers.getAncestors(context, node)) ) { return; } diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/use-isInstance.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/use-isInstance.js index ffd9bc9566..f6d6f5e5d3 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/use-isInstance.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/use-isInstance.js @@ -11,6 +11,7 @@ const fs = require("fs"); const { maybeGetMemberPropertyName } = require("../helpers"); +const helpers = require("../helpers"); const privilegedGlobals = Object.keys( require("../environments/privileged.js").globals @@ -133,7 +134,7 @@ module.exports = { const { operator, right } = node; if ( operator === "instanceof" && - pointsToDOMInterface(context.getScope(), right) + pointsToDOMInterface(helpers.getScope(context, node), right) ) { context.report({ node, diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/use-static-import.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/use-static-import.js index 100b5682de..0a768e25d4 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/use-static-import.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/use-static-import.js @@ -35,7 +35,7 @@ module.exports = { node.init?.type != "CallExpression" || node.init?.callee?.type != "MemberExpression" || !context.getFilename().endsWith(".sys.mjs") || - !helpers.isTopLevel(context.getAncestors()) + !helpers.isTopLevel(helpers.getAncestors(context, node)) ) { return; } diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/valid-lazy.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/valid-lazy.js index 048ed17e3e..2be8840bf7 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/valid-lazy.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/valid-lazy.js @@ -225,7 +225,7 @@ module.exports = { } if ( helpers.getIsTopLevelAndUnconditionallyExecuted( - context.getAncestors() + helpers.getAncestors(context, node) ) ) { context.report({ diff --git a/tools/lint/eslint/eslint-plugin-mozilla/manifest.tt b/tools/lint/eslint/eslint-plugin-mozilla/manifest.tt index c33cc36e38..a804c1392a 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/manifest.tt +++ b/tools/lint/eslint/eslint-plugin-mozilla/manifest.tt @@ -1,9 +1,9 @@ [ { "filename": "eslint-plugin-mozilla.tar.gz", - "size": 5593447, + "size": 5695135, "algorithm": "sha512", - "digest": "ba1f9719d64200e0488003d76f75a189bf4103aa7e653b0aaa0b1053543c5349e3d272eaac006b98f1a3a6530cc0fcfd3aaedc62ce1df6050f737c4865f49d69", + "digest": "84122ccc750528b67632207208c6f53b0bafee52d1ef1ce42a07319008cb49edabaada0931058aafa1c6af66ed49b3a120d9bd40e4b120e4e4cb63ec6cc40e6b", "unpack": true, "visibility": "public" } diff --git a/tools/lint/eslint/eslint-plugin-mozilla/package-lock.json b/tools/lint/eslint/eslint-plugin-mozilla/package-lock.json index c4c36118d2..1b4f8f9b48 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/package-lock.json +++ b/tools/lint/eslint/eslint-plugin-mozilla/package-lock.json @@ -1,12 +1,12 @@ { "name": "eslint-plugin-mozilla", - "version": "3.7.1", + "version": "3.7.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "eslint-plugin-mozilla", - "version": "3.7.1", + "version": "3.7.3", "license": "MPL-2.0", "dependencies": { "eslint-scope": "^7.2.2", @@ -27,7 +27,6 @@ "@microsoft/eslint-plugin-sdl": "^0.2.2", "eslint": "^7.23.0 || ^8.0.0", "eslint-config-prettier": "^8.0.0 || ^9.0.0", - "eslint-plugin-fetch-options": "^0.0.5", "eslint-plugin-html": "^7.0.0 || ^8.0.0", "eslint-plugin-json": "^3.1.0", "eslint-plugin-no-unsanitized": "^4.0.0" @@ -119,9 +118,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", - "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==" + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==" }, "node_modules/@microsoft/eslint-plugin-sdl": { "version": "0.2.2", @@ -277,15 +276,16 @@ } }, "node_modules/array-includes": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", - "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz", + "integrity": "sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==", "peer": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "get-intrinsic": "^1.2.1", + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.4", "is-string": "^1.0.7" }, "engines": { @@ -387,12 +387,15 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", "dev": true, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/brace-expansion": { @@ -560,6 +563,57 @@ "node": ">= 8" } }, + "node_modules/data-view-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", + "integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==", + "peer": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz", + "integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==", + "peer": true, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", + "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", + "peer": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -716,17 +770,21 @@ } }, "node_modules/es-abstract": { - "version": "1.22.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.5.tgz", - "integrity": "sha512-oW69R+4q2wG+Hc3KZePPZxOiisRIqfKBVo/HLx94QcJeWGU/8sZhCvc829rd1kS366vlJbzBfXf9yWwf0+Ko7w==", + "version": "1.23.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", + "integrity": "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==", "peer": true, "dependencies": { "array-buffer-byte-length": "^1.0.1", "arraybuffer.prototype.slice": "^1.0.3", "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.7", + "data-view-buffer": "^1.0.1", + "data-view-byte-length": "^1.0.1", + "data-view-byte-offset": "^1.0.0", "es-define-property": "^1.0.0", "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", "es-set-tostringtag": "^2.0.3", "es-to-primitive": "^1.2.1", "function.prototype.name": "^1.1.6", @@ -737,10 +795,11 @@ "has-property-descriptors": "^1.0.2", "has-proto": "^1.0.3", "has-symbols": "^1.0.3", - "hasown": "^2.0.1", + "hasown": "^2.0.2", "internal-slot": "^1.0.7", "is-array-buffer": "^3.0.4", "is-callable": "^1.2.7", + "is-data-view": "^1.0.1", "is-negative-zero": "^2.0.3", "is-regex": "^1.1.4", "is-shared-array-buffer": "^1.0.3", @@ -751,17 +810,17 @@ "object-keys": "^1.1.1", "object.assign": "^4.1.5", "regexp.prototype.flags": "^1.5.2", - "safe-array-concat": "^1.1.0", + "safe-array-concat": "^1.1.2", "safe-regex-test": "^1.0.3", - "string.prototype.trim": "^1.2.8", - "string.prototype.trimend": "^1.0.7", - "string.prototype.trimstart": "^1.0.7", + "string.prototype.trim": "^1.2.9", + "string.prototype.trimend": "^1.0.8", + "string.prototype.trimstart": "^1.0.8", "typed-array-buffer": "^1.0.2", "typed-array-byte-length": "^1.0.1", "typed-array-byte-offset": "^1.0.2", - "typed-array-length": "^1.0.5", + "typed-array-length": "^1.0.6", "unbox-primitive": "^1.0.2", - "which-typed-array": "^1.1.14" + "which-typed-array": "^1.1.15" }, "engines": { "node": ">= 0.4" @@ -791,6 +850,18 @@ "node": ">= 0.4" } }, + "node_modules/es-object-atoms": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", + "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", + "peer": true, + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/es-set-tostringtag": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", @@ -936,15 +1007,6 @@ "eslint": ">=4.19.1" } }, - "node_modules/eslint-plugin-fetch-options": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/eslint-plugin-fetch-options/-/eslint-plugin-fetch-options-0.0.5.tgz", - "integrity": "sha512-ZMxrccsOAZ7uMQ4nMvPJLqLg6oyLF96YOEwTKWAIbDHpwWUp1raXALZom8ikKucaEnhqWSRuBWI8jBXveFwkJg==", - "peer": true, - "engines": { - "node": ">=0.9.0" - } - }, "node_modules/eslint-plugin-html": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-8.0.0.tgz", @@ -1512,9 +1574,9 @@ } }, "node_modules/hasown": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.1.tgz", - "integrity": "sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "peer": true, "dependencies": { "function-bind": "^1.1.2" @@ -1689,6 +1751,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-data-view": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", + "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", + "peer": true, + "dependencies": { + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-date-object": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", @@ -2192,28 +2269,29 @@ } }, "node_modules/object.entries": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.7.tgz", - "integrity": "sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA==", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.8.tgz", + "integrity": "sha512-cmopxi8VwRIAw/fkijJohSfpef5PdN0pMQJN6VC/ZKvn0LIknWD8KtgY6KlQdEc4tIjcQ3HxSMmnvtzIscdaYQ==", "peer": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/object.fromentries": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", - "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", "peer": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -2223,27 +2301,31 @@ } }, "node_modules/object.hasown": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.3.tgz", - "integrity": "sha512-fFI4VcYpRHvSLXxP7yiZOMAd331cPfd2p7PFDVbgUsYOfCT3tICVqXWngbjr4m49OvsBwUBQ6O2uQoJvy3RexA==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.4.tgz", + "integrity": "sha512-FZ9LZt9/RHzGySlBARE3VF+gE26TxR38SdmqOqliuTnl9wrKulaQs+4dee1V+Io8VfxqzAfHu6YuRgUy8OHoTg==", "peer": true, "dependencies": { - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/object.values": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", - "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz", + "integrity": "sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==", "peer": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -2558,13 +2640,13 @@ } }, "node_modules/safe-array-concat": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.0.tgz", - "integrity": "sha512-ZdQ0Jeb9Ofti4hbt5lX3T2JcAamT9hfzYU1MNB+z/jaEbB6wfFfPIR/zEORmZqobkCCJhSjodobH6WHNmJ97dg==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", + "integrity": "sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==", "peer": true, "dependencies": { - "call-bind": "^1.0.5", - "get-intrinsic": "^1.2.2", + "call-bind": "^1.0.7", + "get-intrinsic": "^1.2.4", "has-symbols": "^1.0.3", "isarray": "^2.0.5" }, @@ -2640,17 +2722,17 @@ } }, "node_modules/set-function-length": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.1.tgz", - "integrity": "sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", "peer": true, "dependencies": { - "define-data-property": "^1.1.2", + "define-data-property": "^1.1.4", "es-errors": "^1.3.0", "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.3", + "get-intrinsic": "^1.2.4", "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.1" + "has-property-descriptors": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -2723,34 +2805,41 @@ } }, "node_modules/string.prototype.matchall": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.10.tgz", - "integrity": "sha512-rGXbGmOEosIQi6Qva94HUjgPs9vKW+dkG7Y8Q5O2OYkWL6wFaTRZO8zM4mhP94uX55wgyrXzfS2aGtGzUL7EJQ==", + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.11.tgz", + "integrity": "sha512-NUdh0aDavY2og7IbBPenWqR9exH+E26Sv8e0/eTe1tltDGZL+GtBkDAnnyBtmekfK6/Dq3MkcGtzXFEd1LQrtg==", "peer": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "get-intrinsic": "^1.2.1", + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", "has-symbols": "^1.0.3", - "internal-slot": "^1.0.5", - "regexp.prototype.flags": "^1.5.0", - "set-function-name": "^2.0.0", - "side-channel": "^1.0.4" + "internal-slot": "^1.0.7", + "regexp.prototype.flags": "^1.5.2", + "set-function-name": "^2.0.2", + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/string.prototype.trim": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", - "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", + "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", "peer": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.0", + "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -2760,28 +2849,31 @@ } }, "node_modules/string.prototype.trimend": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", - "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", + "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", "peer": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/string.prototype.trimstart": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", - "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", "peer": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2939,9 +3031,9 @@ } }, "node_modules/typed-array-length": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.5.tgz", - "integrity": "sha512-yMi0PlwuznKHxKmcpoOdeLwxBoVPkqZxd7q2FgMkmD3bNwvF5VW0+UlUQ1k1vmktTu4Yu13Q0RIxEP8+B+wloA==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.6.tgz", + "integrity": "sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==", "peer": true, "dependencies": { "call-bind": "^1.0.7", @@ -3049,16 +3141,16 @@ } }, "node_modules/which-typed-array": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.14.tgz", - "integrity": "sha512-VnXFiIW8yNn9kIHN88xvZ4yOWchftKDsRJ8fEPacX/wl1lOvBrhsJ/OeJCXq7B0AaijRuqgzSKalJoPk+D8MPg==", + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", + "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", "peer": true, "dependencies": { - "available-typed-arrays": "^1.0.6", - "call-bind": "^1.0.5", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", "for-each": "^0.3.3", "gopd": "^1.0.1", - "has-tostringtag": "^1.0.1" + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" diff --git a/tools/lint/eslint/eslint-plugin-mozilla/package.json b/tools/lint/eslint/eslint-plugin-mozilla/package.json index 5d54e8b387..7384f41401 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/package.json +++ b/tools/lint/eslint/eslint-plugin-mozilla/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-mozilla", - "version": "3.7.1", + "version": "3.7.3", "description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.", "keywords": [ "eslint", @@ -35,7 +35,6 @@ "@microsoft/eslint-plugin-sdl": "^0.2.2", "eslint": "^7.23.0 || ^8.0.0", "eslint-config-prettier": "^8.0.0 || ^9.0.0", - "eslint-plugin-fetch-options": "^0.0.5", "eslint-plugin-html": "^7.0.0 || ^8.0.0", "eslint-plugin-json": "^3.1.0", "eslint-plugin-no-unsanitized": "^4.0.0" diff --git a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-multiple-getters-calls.js b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-multiple-getters-calls.js index a2b88a8652..d9450ad24e 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-multiple-getters-calls.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/reject-multiple-getters-calls.js @@ -46,6 +46,14 @@ ruleTester.run("reject-multiple-getters-calls", rule, { }); } `, + ` + ChromeUtils.defineESModuleGetters(lazy, { + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", + }, { global: "current" }); + ChromeUtils.defineESModuleGetters(lazy, { + PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", + }, { global: "shared" }); + `, ], invalid: [ invalidCode(` @@ -56,5 +64,13 @@ ruleTester.run("reject-multiple-getters-calls", rule, { PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", }); `), + invalidCode(` + ChromeUtils.defineESModuleGetters(lazy, { + AppConstants: "resource://gre/modules/AppConstants.sys.mjs", + }, { global: "current" }); + ChromeUtils.defineESModuleGetters(lazy, { + PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs", + }, { global: "current" }); + `), ], }); diff --git a/tools/lint/eslint/eslint-plugin-spidermonkey-js/lib/environments/self-hosted.js b/tools/lint/eslint/eslint-plugin-spidermonkey-js/lib/environments/self-hosted.js index 37ae42bfa3..bf7069510c 100644 --- a/tools/lint/eslint/eslint-plugin-spidermonkey-js/lib/environments/self-hosted.js +++ b/tools/lint/eslint/eslint-plugin-spidermonkey-js/lib/environments/self-hosted.js @@ -149,7 +149,8 @@ function selfHostingFunctions() { let content = tryReadFile("js/src/vm/SelfHosting.cpp").replace(/\s+/g, ""); let globals = Object.create(null); - for (let m of content.matchAll(/(?:JS_FN|JS_INLINABLE_FN)\("(\w+)"/g)) { + let re = /(?:JS_FN|JS_INLINABLE_FN|JS_TRAMPOLINE_FN)\("(\w+)"/g; + for (let m of content.matchAll(re)) { globals[m[1]] = "readonly"; } return globals; diff --git a/tools/lint/eslint/manifest.tt b/tools/lint/eslint/manifest.tt index bee00211ab..540b2da8e8 100644 --- a/tools/lint/eslint/manifest.tt +++ b/tools/lint/eslint/manifest.tt @@ -1,9 +1,9 @@ [ { "filename": "eslint.tar.gz", - "size": 22159369, + "size": 22290302, "algorithm": "sha512", - "digest": "683b12e0c7463c4e5ba0ec47d680744d7eb870438822963557526d490c36a6a7929d9d0471fbac9dd6f549953285ac734f25a9e0cb1b3651c38350e5582cce5e", + "digest": "e1db81761e5eb2761af1d8117b1b336ad1979ccc0cfcaca0b72a4772aee9e9b98b532c71b4e125fbef574b75100b8e9102465638fbd90996784c2d4e5b90b98c", "unpack": true, "visibility": "public" } -- cgit v1.2.3