Bug 1881701 - Fix remainder of newly raised devtools issues after switching to the ESLint flat config. r=devtools-reviewers,frontend-codestyle-reviewers,mossop,nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D249957
This commit is contained in:
Mark Banner
2025-05-24 17:08:35 +00:00
committed by mbanner@mozilla.com
parent ee9933d77b
commit b20fbf2ba1
15 changed files with 42 additions and 41 deletions

View File

@@ -163,6 +163,7 @@ const extraBrowserTestPaths = [
"devtools/shared/commands/inspected-window/tests/",
"devtools/shared/commands/inspector/tests/",
"devtools/shared/commands/network/tests/",
"devtools/shared/commands/object/tests/",
"devtools/shared/commands/resource/tests/",
"devtools/shared/commands/script/tests/",
"devtools/shared/commands/target-configuration/tests/",

View File

@@ -289,4 +289,15 @@ export default [
files: ["**/node/**"],
languageOptions: { globals: globals.jest },
},
{
// Bug 1967461 - Fix the files and re-enable these rules.
files: [
"client/shared/components/object-inspector/components/ObjectInspector.js",
"client/shared/components/object-inspector/components/ObjectInspectorItem.js",
],
rules: {
"react/prop-types": "off",
"react/sort-comp": "off",
},
},
];

View File

@@ -58,6 +58,7 @@ export function bootstrapStore(client, workers, panel, initialState) {
registerStoreObserver(store, updatePrefs);
const actions = bindActionCreators(
// eslint-disable-next-line mozilla/reject-relative-requires
require("../actions/index").default,
store.dispatch
);

View File

@@ -4,6 +4,7 @@
"use strict";
// eslint-disable-next-line mozilla/reject-relative-requires
const Babel = require("./babel");
const _path = require("path");

View File

@@ -10,6 +10,7 @@
"use strict";
// eslint-disable-next-line mozilla/reject-relative-requires
const Babel = require("./babel");
const fs = require("fs");
const _path = require("path");
@@ -19,7 +20,8 @@ const defaultPlugins = ["proposal-class-properties"];
function transform(filePath) {
// Use the extra plugins only for the debugger
const plugins = filePath.includes("devtools/client/debugger")
? require("./build-debugger")(filePath)
? // eslint-disable-next-line mozilla/reject-relative-requires
require("./build-debugger")(filePath)
: defaultPlugins;
const doc = fs.readFileSync(filePath, "utf8");

View File

@@ -11,7 +11,7 @@ const {
nodeIsBucket,
getFront,
} = require("resource://devtools/client/shared/components/object-inspector/utils/node.js");
const { getLoadedProperties, getWatchpoints } = require("resource://devtools/client/shared/components/object-inspector/reducer.js");
const { getLoadedProperties } = require("resource://devtools/client/shared/components/object-inspector/reducer.js");
/**
* This action is responsible for expanding a given node, which also means that
@@ -194,7 +194,7 @@ async function releaseActors(client, oldRoots, newRoots = []) {
}
function invokeGetter(node, receiverId) {
return async ({ dispatch, client, getState }) => {
return async ({ dispatch, client, _getState }) => {
try {
const objectFront =
getParentFront(node) ||

View File

@@ -80,7 +80,7 @@ class ObjectInspector extends Component {
static defaultProps = {
autoReleaseObjectActors: true
};
constructor(props) {
constructor(_props) {
super();
this.cachedNodes = new Map();
@@ -358,7 +358,7 @@ class ObjectInspector extends Component {
}
}
function mapStateToProps(state, props) {
function mapStateToProps(state, _props) {
return {
expandedPaths: getExpandedPaths(state),
loadedProperties: getLoadedProperties(state),
@@ -368,6 +368,7 @@ function mapStateToProps(state, props) {
const OI = connect(mapStateToProps, actions)(ObjectInspector);
// eslint-disable-next-line react/display-name
module.exports = props => {
const { roots, standalone = false } = props;

View File

@@ -544,6 +544,7 @@ function makeNodesForOwnProps(propertiesNames, parent, ownProperties) {
});
}
// eslint-disable-next-line complexity
function makeNodesForProperties(objProps, parent) {
const {
ownProperties = {},

View File

@@ -4,7 +4,8 @@
"use strict";
const { DevToolsServer } = require("resource://devtools/server/devtools-server.js");
/* global Temporal, TrustedHTML, TrustedScript, TrustedScriptURL */
const DevToolsUtils = require("resource://devtools/shared/DevToolsUtils.js");
loader.lazyRequireGetter(
this,
@@ -229,63 +230,56 @@ const previewers = {
],
"Temporal.Instant": [
function(objectActor, grip, depth) {
function(objectActor, grip, _depth) {
temporalPreviewer(Temporal.Instant, objectActor, grip);
return true;
},
],
"Temporal.PlainDate": [
function(objectActor, grip, depth) {
function(objectActor, grip, _depth) {
temporalPreviewer(Temporal.PlainDate, objectActor, grip);
return true;
},
],
"Temporal.PlainDateTime": [
function(objectActor, grip, depth) {
function(objectActor, grip, _depth) {
temporalPreviewer(Temporal.PlainDateTime, objectActor, grip);
return true;
},
],
"Temporal.PlainDate": [
function(objectActor, grip, depth) {
temporalPreviewer(Temporal.PlainDate, objectActor, grip);
return true;
},
],
"Temporal.PlainMonthDay": [
function(objectActor, grip, depth) {
function(objectActor, grip, _depth) {
temporalPreviewer(Temporal.PlainMonthDay, objectActor, grip);
return true;
},
],
"Temporal.PlainTime": [
function(objectActor, grip, depth) {
function(objectActor, grip, _depth) {
temporalPreviewer(Temporal.PlainTime, objectActor, grip);
return true;
},
],
"Temporal.PlainYearMonth": [
function(objectActor, grip, depth) {
function(objectActor, grip, _depth) {
temporalPreviewer(Temporal.PlainYearMonth, objectActor, grip);
return true;
},
],
"Temporal.ZonedDateTime": [
function(objectActor, grip, depth) {
function(objectActor, grip, _depth) {
temporalPreviewer(Temporal.ZonedDateTime, objectActor, grip);
return true;
},
],
"Temporal.Duration": [
function(objectActor, grip, depth) {
function(objectActor, grip, _depth) {
temporalPreviewer(Temporal.Duration, objectActor, grip);
return true;
},
@@ -858,6 +852,7 @@ function temporalPreviewer(cls, objectActor, grip) {
* when we are inspecting nested attributes.
* @returns
*/
// eslint-disable-next-line complexity
function GenericObject(objectActor, grip, depth) {
const { obj, safeRawObj } = objectActor;
if (grip.preview || grip.displayString || depth > 1) {

View File

@@ -54,8 +54,8 @@ class PropertyIteratorActor extends Actor {
if (!DevToolsUtils.isSafeDebuggerObject(objectActor.obj)) {
this.iterator = {
size: 0,
propertyName: index => undefined,
propertyDescription: index => undefined,
propertyName: _index => undefined,
propertyDescription: _index => undefined,
};
} else if (options.enumEntries) {
const cls = objectActor.className;
@@ -663,6 +663,7 @@ function enumCustomStateSetEntries(objectActor, depth) {
// We also need to waive Xrays on the result of the call to `values` as we don't have
// Xrays to Iterator objects (see Bug 1023984)
const values = Array.from(
// eslint-disable-next-line no-undef
waiveXrays(CustomStateSet.prototype.values.call(waiveXrays(rawObj)))
);

View File

@@ -24,14 +24,6 @@ loader.lazyRequireGetter(
true
);
loader.lazyRequireGetter(
this,
"EnvironmentActor",
"resource://devtools/server/actors/environment.js",
true
);
/**
* Get thisDebugger.Object referent's `promiseState`.
*

View File

@@ -9,9 +9,10 @@
* of all inspected JavaScript objects.
*/
class ObjectCommand {
constructor({ commands, descriptorFront, watcherFront }) {
constructor({ commands, _descriptorFront, _watcherFront }) {
this.#commands = commands;
}
// eslint-disable-next-line no-unused-private-class-members
#commands = null;
/**

View File

@@ -11,8 +11,6 @@ add_task(async function testObjectRelease() {
const commands = await CommandsFactory.forTab(tab);
await commands.targetCommand.startListening();
const { objectCommand } = commands;
const evaluationResponse = await commands.scriptCommand.execute(
"window.foo"
);
@@ -72,8 +70,6 @@ add_task(async function testMultiTargetObjectRelease() {
const [,iframeTarget] = commands.targetCommand.getAllTargets(commands.targetCommand.ALL_TYPES);
is(iframeTarget.url, "data:text/html,bar");
const { objectCommand } = commands;
const evaluationResponse1 = await commands.scriptCommand.execute(
"window"
);
@@ -107,8 +103,6 @@ add_task(async function testWorkerObjectRelease() {
const [,workerTarget] = commands.targetCommand.getAllTargets(commands.targetCommand.ALL_TYPES);
is(workerTarget.url, workerUrl);
const { objectCommand } = commands;
const evaluationResponse = await commands.scriptCommand.execute(
"foo", {
selectedTargetFront: workerTarget,

View File

@@ -3,6 +3,7 @@
/* eslint-disable object-shorthand */
// eslint-disable-next-line mozilla/reject-import-system-module-from-non-system
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
// Try replicating real world environment, by using
@@ -495,6 +496,7 @@ const Errors = [
prefs: [
["javascript.options.experimental.explicit_resource_management", true],
],
// eslint-disable-next-line no-constant-binary-expression
disabled: true || !AppConstants.ENABLE_EXPLICIT_RESOURCE_MANAGEMENT,
},
];

View File

@@ -112,7 +112,6 @@ function loadExpectedValues(expectedValuesFileName) {
gExpectedValuesFilePath = Services.io.newURI(resHandler.resolveURI(resURL)).QueryInterface(Ci.nsIFileURL).file.path;
}
let expectedValues;
if (!isUpdate) {
dump(`Loading test data file: ${url}\n`);
return ChromeUtils.importESModule(url).default;
@@ -225,7 +224,6 @@ async function runTest(expectedValuesFileName, testFunction) {
"`More info in https://firefox-source-docs.mozilla.org/devtools/tests/js-object-tests.html\n";
const isMochitest = "gTestPath" in gTestScope;
const isXpcshell = !isMochitest;
// If we aren't in "update" mode, we are reading assertion values from $EXPECTED_VALUES_FILE
// and will assert the current returned values against these values
@@ -236,7 +234,7 @@ async function runTest(expectedValuesFileName, testFunction) {
} catch(e) {
// deepEqual only throws in case of differences when running in XPCShell tests. Mochitest won't throw and keep running.
// XPCShell will stop at the first failing assertion, so ensure showing our failure message and ok() will throw and stop the test.
if (isXpcshell) {
if (!isMochitest) {
gTestScope.Assert.ok(false, failureMessage);
}
throw e;