Bug 1917530 - Fix ESLint no-shadow issues in devtools code. r=devtools-reviewers,profiler-reviewers,frontend-codestyle-reviewers,nchevobbe,julienw,mossop

Differential Revision: https://phabricator.services.mozilla.com/D221442
This commit is contained in:
Mark Banner 2024-09-12 21:08:43 +00:00
Родитель 5f340a7a98
Коммит 7f08ffc091
9 изменённых файлов: 25 добавлений и 7 удалений

Просмотреть файл

@ -45,6 +45,7 @@ const xpcshellTestPaths = [
// of the file.
const extraXpcshellTestPaths = [
"devtools/client/shared/remote-debugging/adb/xpcshell/",
"devtools/platform/tests/xpcshell/",
"dom/file/tests/",
"dom/ipc/tests/",

Просмотреть файл

@ -9,12 +9,18 @@ module.exports = {
globals: {
exports: true,
isWorker: true,
loader: true,
module: true,
require: true,
DebuggerNotificationObserver: true,
},
overrides: [
{
files: ["**/*.*"],
excludedFiles: ["**/*.sys.mjs", "**/*.worker.js"],
globals: {
loader: true,
module: true,
require: true,
},
},
{
files: ["client/framework/**"],
rules: {

Просмотреть файл

@ -6,7 +6,6 @@
// Parent config file for all devtools xpcshell files.
module.exports = {
extends: ["plugin:mozilla/xpcshell-test"],
rules: {
// Allow non-camelcase so that run_test doesn't produce a warning.
camelcase: "off",

Просмотреть файл

@ -5,7 +5,6 @@
"use strict";
module.exports = {
env: { browser: true },
globals: {
define: true,
},

Просмотреть файл

@ -34,6 +34,7 @@ const { getCompactSymbolTable, queryAPI } = wasm_bindgen;
// message properties.
function createPlainErrorObject(e) {
// Regular errors: just rewrap the object.
// eslint-disable-next-line no-shadow
const { name, message, fileName, lineNumber } = e;
return { name, message, fileName, lineNumber };
}
@ -65,6 +66,7 @@ class FileAndPathHelper {
);
}
// eslint-disable-next-line no-shadow
const { name, path, debugPath, arch } = lib;
const candidatePaths = [];
@ -152,6 +154,7 @@ class FileAndPathHelper {
);
}
// eslint-disable-next-line no-shadow
const { name, path, arch } = lib;
const candidatePaths = [];

Просмотреть файл

@ -419,6 +419,7 @@ export function getAllBrowsingContextsForContext(
}
if (typeof module == "object") {
// eslint-disable-next-line no-undef
module.exports = {
isBrowsingContextPartOfContext,
isWindowGlobalPartOfContext,

Просмотреть файл

@ -46,6 +46,7 @@ const listeners = new Set();
// Detecting worker is different if this file is loaded via Common JS loader (isWorker global)
// or as a JSM (constructor name)
// eslint-disable-next-line no-shadow
const isWorker =
globalThis.isWorker ||
globalThis.constructor.name == "WorkerDebuggerGlobalScope";
@ -70,6 +71,8 @@ const customLazy = {
// this module no longer has WorkerDebuggerGlobalScope as global,
// but has to use require() to pull Debugger.
if (isWorker) {
// require is defined for workers.
// eslint-disable-next-line no-undef
return require("Debugger");
}
const { addDebuggerToGlobal } = ChromeUtils.importESModule(

Просмотреть файл

@ -129,6 +129,7 @@ export function workerify(fn) {
"used in production."
);
// Fetch modules here as we don't want to include it normally.
// eslint-disable-next-line no-shadow
const { URL, Blob } = Services.wm.getMostRecentWindow("navigator:browser");
const stringifiedFn = createWorkerString(fn);
const blob = new Blob([stringifiedFn]);

Просмотреть файл

@ -515,7 +515,7 @@ DevToolsStartup.prototype = {
};
}
const console = cmdLine.handleFlag("jsconsole", false);
const jsConsole = cmdLine.handleFlag("jsconsole", false);
const devtools = cmdLine.handleFlag("devtools", false);
let devToolsServer;
@ -539,7 +539,12 @@ DevToolsStartup.prototype = {
debuggerFlag = cmdLine.handleFlag("jsdebugger", false);
}
return { console, debugger: debuggerFlag, devtools, devToolsServer };
return {
console: jsConsole,
debugger: debuggerFlag,
devtools,
devToolsServer,
};
},
/**