Bug 1593921 - Use eslint-disable-next-line to disable complexity checks in DevTools r=pbro

Using next-line is less error prone for refactorings than wrapping methods with enable/disable blocks.

Differential Revision: https://phabricator.services.mozilla.com/D51782
This commit is contained in:
Julian Descottes
2019-11-05 14:29:04 +00:00
parent cd92f0ff8a
commit 03cdcd7b0a
44 changed files with 63 additions and 125 deletions

View File

@@ -101,7 +101,7 @@ function getUniqueIdentifiers(identifiers) {
return newIdentifiers;
}
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function extractSymbol(path: SimplePath, symbols, state) {
if (isFunction(path)) {
const name = getFunctionName(path.node, path.parent);
@@ -263,8 +263,6 @@ function extractSymbol(path: SimplePath, symbols, state) {
}
}
/* eslint-enable complexity */
function extractSymbols(sourceId): SymbolDeclarations {
const symbols = {
functions: [],

View File

@@ -198,7 +198,7 @@ const reducers = {
* - when changes cancel each other out leaving the rule unchanged, the rule is removed
* from the store. Its parent rule is removed as well if it too ends up unchanged.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
[TRACK_CHANGE](state, { change }) {
const defaults = {
selector: null,
@@ -363,7 +363,6 @@ const reducers = {
return state;
},
/* eslint-enable complexity */
[RESET_CHANGES](state) {
return INITIAL_STATE;

View File

@@ -383,7 +383,7 @@ CssComputedView.prototype = {
* - value {Object} Depends on the type of the node
* returns null if the node isn't anything we care about
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
getNodeInfo: function(node) {
if (!node) {
return null;
@@ -500,7 +500,6 @@ CssComputedView.prototype = {
value,
};
},
/* eslint-enable complexity */
_createPropertyViews: function() {
if (this._createViewsPromise) {

View File

@@ -287,7 +287,6 @@ class FontInspector {
// Round pixel values.
return Math.round(out);
}
/* eslint-enable complexity */
/**
* Destruction function called when the inspector is destroyed. Removes event listeners

View File

@@ -214,7 +214,7 @@ SelectorAutocompleter.prototype = {
* '#f' requires an Id suggestion, so the state is States.ID
* 'div > .foo' requires class suggestion, so state is States.CLASS
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
get state() {
if (!this.searchBox || !this.searchBox.value) {
return null;
@@ -308,7 +308,6 @@ SelectorAutocompleter.prototype = {
}
return this._state;
},
/* eslint-enable complexity */
/**
* Removes event listeners and cleans up references.

View File

@@ -455,7 +455,7 @@ CssRuleView.prototype = {
* - value {Object} Depends on the type of the node
* returns null of the node isn't anything we care about
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
getNodeInfo: function(node) {
if (!node) {
return null;
@@ -581,7 +581,6 @@ CssRuleView.prototype = {
value,
};
},
/* eslint-enable complexity */
/**
* Retrieve the RuleEditor instance.
@@ -1303,7 +1302,7 @@ CssRuleView.prototype = {
/**
* Creates editor UI for each of the rules in _elementStyle.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
_createEditors: function() {
// Run through the current list of rules, attaching
// their editors in order. Create editors if needed.
@@ -1386,7 +1385,6 @@ CssRuleView.prototype = {
return promise.all(editorReadyPromises);
},
/* eslint-enable complexity */
/**
* Highlight rules that matches the filter search value and returns a

View File

@@ -444,7 +444,7 @@ TextPropertyEditor.prototype = {
/**
* Populate the span based on changes to the TextProperty.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
update: function() {
if (this.ruleView.isDestroyed) {
return;
@@ -711,7 +711,6 @@ TextPropertyEditor.prototype = {
}
}
},
/* eslint-enable complexity */
_onStartEditing: function() {
this.element.classList.remove("ruleview-overridden");

View File

@@ -104,7 +104,7 @@ exports.getCustomTreeMapDisplays = function() {
* @param {snapshotState | diffingState} state
* @return {String}
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
exports.getStatusText = function(state) {
assert(state, "Must have a state");
@@ -172,7 +172,6 @@ exports.getStatusText = function(state) {
return "";
}
};
/* eslint-enable complexity */
/**
* Returns a string representing a readable form of the snapshot's state;
@@ -181,7 +180,7 @@ exports.getStatusText = function(state) {
* @param {snapshotState | diffingState} state
* @return {String}
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
exports.getStatusTextFull = function(state) {
assert(!!state, "Must have a state");
@@ -249,7 +248,6 @@ exports.getStatusTextFull = function(state) {
return "";
}
};
/* eslint-enable complexity */
/**
* Return true if the snapshot is in a diffable state, false otherwise.

View File

@@ -45,7 +45,7 @@ class RequestListContextMenu {
this.props = props;
}
/* eslint-disable complexity */
// eslint-disable-next-line complexity
open(event, clickedRequest, requests, blockedUrls) {
const {
id,

View File

@@ -42,7 +42,7 @@ const gFrameData = new WeakMap();
* Parses the raw location of this function call to retrieve the actual
* function name, source url, host name, line and column.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function parseLocation(location, fallbackLine, fallbackColumn) {
// Parse the `location` for the function name, source url, line, column etc.
@@ -198,7 +198,6 @@ function parseLocation(location, fallbackLine, fallbackColumn) {
return { functionName, fileName, host, port, url, line, column };
}
/* eslint-enable complexity */
/**
* Sets the properties of `isContent` and `category` on a frame.

View File

@@ -123,7 +123,7 @@ class Frame extends Component {
};
}
/* eslint-disable complexity */
// eslint-disable-next-line complexity
render() {
let frame, isSourceMapped;
const {
@@ -306,7 +306,6 @@ class Frame extends Component {
return dom.span(attributes, ...elements);
}
/* eslint-enable complexity */
}
module.exports = Frame;

View File

@@ -577,7 +577,7 @@ class Tree extends Component {
*
* @param {Event} e
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
_onKeyDown(e) {
if (this.props.focused == null) {
return;
@@ -653,7 +653,6 @@ class Tree extends Component {
break;
}
}
/* eslint-enable complexity */
get activeElement() {
return this.refs.tree.ownerDocument.activeElement;

View File

@@ -220,7 +220,7 @@ class SplitBox extends Component {
// Rendering
/* eslint-disable complexity */
// eslint-disable-next-line complexity
render() {
const { endPanelControl, splitterSize, vert } = this.state;
const {
@@ -331,7 +331,6 @@ class SplitBox extends Component {
: null
);
}
/* eslint-enable complexity */
}
module.exports = SplitBox;

View File

@@ -298,7 +298,7 @@ define(function(require, exports, module) {
// Event Handlers
/* eslint-disable complexity */
// eslint-disable-next-line complexity
onKeyDown(event) {
if (!SUPPORTED_KEYS.includes(event.key)) {
return;
@@ -384,7 +384,6 @@ define(function(require, exports, module) {
this.treeRef.current.focus();
event.preventDefault();
}
/* eslint-enable complexity */
onClickRow(nodePath, event) {
const onClickRow = this.props.onClickRow;

View File

@@ -1160,7 +1160,7 @@ InplaceEditor.prototype = {
/**
* Handle the input field's keypress event.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
_onKeyPress: function(event) {
let prevent = false;
@@ -1309,7 +1309,6 @@ InplaceEditor.prototype = {
event.preventDefault();
}
},
/* eslint-enable complexity */
_onContextMenu: function(event) {
if (this.contextMenu) {
@@ -1444,7 +1443,7 @@ InplaceEditor.prototype = {
// Since we are calling this method from a keypress event handler, the
// |input.value| does not include currently typed character. Thus we perform
// this method async.
/* eslint-disable complexity */
// eslint-disable-next-line complexity
this._openPopupTimeout = this.doc.defaultView.setTimeout(() => {
if (this._preventSuggestions) {
this._preventSuggestions = false;
@@ -1646,7 +1645,6 @@ InplaceEditor.prototype = {
this.emit("after-suggest");
this._doValidation();
}, 0);
/* eslint-enable complexity */
},
/**

View File

@@ -326,7 +326,6 @@ OutputParser.prototype = {
return variableNode;
},
/* eslint-disable complexity */
/**
* The workhorse for @see _parse. This parses some CSS text,
* stopping at EOF; or optionally when an umatched close paren is
@@ -343,6 +342,7 @@ OutputParser.prototype = {
* @return {DocumentFragment}
* A document fragment.
*/
// eslint-disable-next-line complexity
_doParse: function(text, options, tokenStream, stopAtCloseParen) {
let parenDepth = stopAtCloseParen ? 1 : 0;
let outerMostFunctionTakesColor = false;
@@ -594,7 +594,6 @@ OutputParser.prototype = {
return result;
},
/* eslint-enable complexity */
/**
* Parse a string.
@@ -775,7 +774,7 @@ OutputParser.prototype = {
* The node to which spans containing points are added.
* @returns {Node} The container to which spans have been added.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
_addPolygonPointNodes: function(coords, container) {
const tokenStream = getCSSLexer(coords);
let token = tokenStream.nextToken();
@@ -914,7 +913,6 @@ OutputParser.prototype = {
}
return container;
},
/* eslint-enable complexity */
/**
* Parse the given circle coordinates and populate the given container appropriately
@@ -926,7 +924,7 @@ OutputParser.prototype = {
* The node to which the definition is added.
* @returns {Node} The container to which the definition has been added.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
_addCirclePointNodes: function(coords, container) {
const tokenStream = getCSSLexer(coords);
let token = tokenStream.nextToken();
@@ -1076,7 +1074,6 @@ OutputParser.prototype = {
}
return container;
},
/* eslint-enable complexity */
/**
* Parse the given ellipse coordinates and populate the given container appropriately
@@ -1088,7 +1085,7 @@ OutputParser.prototype = {
* The node to which the definition is added.
* @returns {Node} The container to which the definition has been added.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
_addEllipsePointNodes: function(coords, container) {
const tokenStream = getCSSLexer(coords);
let token = tokenStream.nextToken();
@@ -1248,7 +1245,6 @@ OutputParser.prototype = {
}
return container;
},
/* eslint-enable complexity */
/**
* Parse the given inset coordinates and populate the given container appropriately.
@@ -1259,7 +1255,7 @@ OutputParser.prototype = {
* The node to which the definition is added.
* @returns {Node} The container to which the definition has been added.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
_addInsetPointNodes: function(coords, container) {
const insetPoints = ["top", "right", "bottom", "left"];
const tokenStream = getCSSLexer(coords);
@@ -1394,7 +1390,6 @@ OutputParser.prototype = {
return container;
},
/* eslint-enable complexity */
/**
* Append a angle value to the output

View File

@@ -256,7 +256,7 @@ function isContentScheme(location, i = 0) {
}
}
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function isChromeScheme(location, i = 0) {
const firstChar = location.charCodeAt(i);
@@ -308,7 +308,6 @@ function isChromeScheme(location, i = 0) {
return false;
}
}
/* eslint-enable complexity */
function isWASM(location, i = 0) {
return (

View File

@@ -4,7 +4,6 @@
"use strict";
/* eslint-disable complexity */
const {
cssTokenizer,
cssTokenizerWithLineColumn,
@@ -166,6 +165,7 @@ CSSCompleter.prototype = {
* @returns CSS_STATE
* One of CSS_STATE enum or null if the state cannot be resolved.
*/
// eslint-disable-next-line complexity
resolveState: function(source, { line, ch }) {
// Function to return the last element of an array
const peek = arr => arr[arr.length - 1];

View File

@@ -716,7 +716,7 @@ class Telemetry {
* The ID of the tool that has been opened.
*
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function getChartsFromToolId(id) {
if (!id) {
return null;
@@ -794,7 +794,6 @@ function getChartsFromToolId(id) {
countScalar: countScalar,
};
}
/* eslint-enable complexity */
/**
* Displays the first caller and calling line outside of this file in the

View File

@@ -812,7 +812,7 @@ VariablesView.prototype = {
/**
* Listener handling a key down event on the view.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
_onViewKeyDown: function(e) {
const item = this.getFocusedItem();
@@ -919,7 +919,6 @@ VariablesView.prototype = {
item._onAddProperty(e);
}
},
/* eslint-enable complexity */
/**
* Sets the text displayed in this container when there are no available items.
@@ -2963,7 +2962,7 @@ Variable.prototype = extend(Scope.prototype, {
* and specifies if it's a 'this', '<exception>', '<return>' or '__proto__'
* reference.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
_setAttributes: function() {
const ownerView = this.ownerView;
if (ownerView.preventDescriptorModifiers) {
@@ -3021,7 +3020,6 @@ Variable.prototype = extend(Scope.prototype, {
target.setAttribute("pseudo-item", "");
}
},
/* eslint-enable complexity */
/**
* Adds the necessary event listeners for this variable.

View File

@@ -278,7 +278,7 @@ class Message extends Component {
);
}
/* eslint-disable complexity */
// eslint-disable-next-line complexity
render() {
if (this.state && this.state.error) {
return this.renderErrorState();
@@ -490,7 +490,6 @@ class Message extends Component {
attachment ? null : dom.br()
);
}
/* eslint-enable complexity */
}
module.exports = Message;

View File

@@ -144,7 +144,7 @@ function cloneState(state) {
* @param {UiState} uiState: The ui state.
* @returns {MessageState} a new messages state.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function addMessage(newMessage, state, filtersState, prefsState, uiState) {
const { messagesById, groupsById, currentGroup, repeatById } = state;
@@ -354,9 +354,8 @@ function addMessage(newMessage, state, filtersState, prefsState, uiState) {
return removeMessagesFromState(state, removedIds);
}
/* eslint-enable complexity */
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function messages(
state = MessageState(),
action,
@@ -692,7 +691,6 @@ function messages(
return state;
}
/* eslint-enable complexity */
function setVisibleMessages({
messagesState,
@@ -986,7 +984,7 @@ function getToplevelMessageCount(state) {
* - visible {Boolean}: true if the message should be visible
* - cause {String}: if visible is false, what causes the message to be hidden.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function getMessageVisibility(
message,
{
@@ -1177,7 +1175,6 @@ function getMessageVisibility(
visible: true,
};
}
/* eslint-enable complexity */
function isUnfilterable(message) {
return [

View File

@@ -14,7 +14,7 @@ const {
const cachedPackets = {};
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function getCleanedPacket(key, packet) {
if (Object.keys(cachedPackets).includes(key)) {
return cachedPackets[key];
@@ -279,7 +279,6 @@ function getCleanedPacket(key, packet) {
cachedPackets[key] = res;
return res;
}
/* eslint-enable complexity */
function formatPacket(key, packet) {
const stringifiedPacket = JSON.stringify(

View File

@@ -116,7 +116,7 @@ function transformPacket(packet) {
}
}
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function transformConsoleAPICallPacket(packet) {
const { message } = packet;
@@ -265,7 +265,6 @@ function transformConsoleAPICallPacket(packet) {
chromeContext: message.chromeContext,
});
}
/* eslint-enable complexity */
function transformNavigationMessagePacket(packet) {
const { url } = packet;

View File

@@ -614,7 +614,7 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, {
* @param {Ci.nsIAccessibleEvent} subject
* accessible event object.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
observe(subject) {
const event = subject.QueryInterface(Ci.nsIAccessibleEvent);
const rawAccessible = event.accessible;
@@ -734,7 +734,6 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, {
break;
}
},
/* eslint-enable complexity */
/**
* Ensure that nothing interferes with the audit for an accessible object

View File

@@ -500,7 +500,7 @@ var WebExtensionInspectedWindowActor = protocol.ActorClassWithSpec(
* it is called over the remote debugging protocol the target window is always
* `targetActor.window`.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
eval(callerInfo, expression, options, customTargetWindow) {
const window = customTargetWindow || this.window;
options = options || {};
@@ -689,7 +689,6 @@ var WebExtensionInspectedWindowActor = protocol.ActorClassWithSpec(
return { value: evalResult };
},
/* eslint-enable complexity */
}
);

View File

@@ -172,7 +172,7 @@ BreakpointActor.prototype = {
* @param frame Debugger.Frame
* The stack frame that contained the breakpoint.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
hit: function(frame) {
// Don't pause if we are currently stepping (in or over) or the frame is
// black-boxed.
@@ -234,7 +234,6 @@ BreakpointActor.prototype = {
return this.threadActor._pauseAndRespond(frame, reason);
},
/* eslint-enable complexity */
delete: function() {
// Remove from the breakpoint store.

View File

@@ -92,7 +92,7 @@ TouchSimulator.prototype = {
this._isPicking = state;
},
/* eslint-disable complexity */
// eslint-disable-next-line complexity
handleEvent(evt) {
// Bail out if devtools is in pick mode in the same tab.
if (this._isPicking) {
@@ -282,7 +282,6 @@ TouchSimulator.prototype = {
evt.stopImmediatePropagation();
}
},
/* eslint-enable complexity */
fireMouseEvent(type, evt) {
const content = this.getContent(evt.target);

View File

@@ -1273,7 +1273,7 @@ class CssGridHighlighter extends AutoRefreshHighlighter {
* @param {Boolean||undefined} isStackedLine
* Boolean indicating if the line is stacked.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
renderGridLineNumber(
lineNumber,
linePos,
@@ -1489,7 +1489,6 @@ class CssGridHighlighter extends AutoRefreshHighlighter {
this.ctx.fillText(numberText, x, y);
this.ctx.restore();
}
/* eslint-enable complexity */
/**
* Determine which edge of a line number box to aim the line number arrow at.

View File

@@ -630,7 +630,7 @@ class FlexboxHighlighter extends AutoRefreshHighlighter {
/**
* Clear the whole alignment container along the main axis for each flex item.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
renderJustifyContent() {
if (
!this.flexData ||
@@ -755,7 +755,6 @@ class FlexboxHighlighter extends AutoRefreshHighlighter {
this.ctx.restore();
}
/* eslint-enable complexity */
/**
* Set up the canvas with the given options prior to drawing.
@@ -965,7 +964,7 @@ function getRectFromFlexItemValues(item, container) {
* The new Flex data object.
* @return {Boolean} true if the flex data has changed and false otherwise.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function compareFlexData(oldFlexData, newFlexData) {
if (!oldFlexData || !newFlexData) {
return true;
@@ -1032,6 +1031,5 @@ function compareFlexData(oldFlexData, newFlexData) {
return false;
}
/* eslint-enable complexity */
exports.FlexboxHighlighter = FlexboxHighlighter;

View File

@@ -515,7 +515,7 @@ class ShapesHighlighter extends AutoRefreshHighlighter {
this.viewport = { left, right, top, bottom, padding };
}
/* eslint-disable complexity */
// eslint-disable-next-line complexity
handleEvent(event, id) {
// No event handling if the highlighter is hidden
if (this.areShapesHidden()) {
@@ -621,7 +621,6 @@ class ShapesHighlighter extends AutoRefreshHighlighter {
break;
}
}
/* eslint-enable complexity */
/**
* Handle a mouse click in transform mode.
@@ -1981,7 +1980,7 @@ class ShapesHighlighter extends AutoRefreshHighlighter {
* @returns {String} "top", "left", "right", or "bottom" if any of those edges were
* clicked. "" if none were clicked.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
getInsetPointAt(pageX, pageY) {
const { top, left, right, bottom } = this.coordinates;
const zoom = getCurrentZoom(this.win);
@@ -2049,7 +2048,6 @@ class ShapesHighlighter extends AutoRefreshHighlighter {
return "";
}
/* eslint-enable complexity */
/**
* Parses the CSS definition given and returns the shape type associated

View File

@@ -409,7 +409,7 @@ class DOMEventCollector extends MainEventCollector {
* Get or detect jQuery events.
*/
class JQueryEventCollector extends MainEventCollector {
/* eslint-disable complexity */
// eslint-disable-next-line complexity
getListeners(node, { checkOnly } = {}) {
const jQuery = this.getJQuery(node);
const handlers = [];
@@ -501,14 +501,13 @@ class JQueryEventCollector extends MainEventCollector {
}
return handlers;
}
/* eslint-enable complexity */
}
/**
* Get or detect jQuery live events.
*/
class JQueryLiveEventCollector extends MainEventCollector {
/* eslint-disable complexity */
// eslint-disable-next-line complexity
getListeners(node, { checkOnly } = {}) {
const jQuery = this.getJQuery(node);
const handlers = [];
@@ -601,7 +600,6 @@ class JQueryLiveEventCollector extends MainEventCollector {
}
return handlers;
}
/* eslint-enable complexity */
normalizeListener(handlerDO) {
function isFunctionInProxy(funcDO) {
@@ -903,7 +901,7 @@ class EventCollector {
* native: false
* }
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
processHandlerForEvent(listenerArray, listener, dbg) {
let globalDO;
@@ -1067,7 +1065,6 @@ class EventCollector {
}
}
}
/* eslint-enable complexity */
}
exports.EventCollector = EventCollector;

View File

@@ -919,7 +919,7 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
* hasLast: true if the last child of the node is included in the list.
* nodes: Array of DOMNodes.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
_getChildren: function(node, options = {}) {
if (isNodeDead(node)) {
return { hasFirst: true, hasLast: true, nodes: [] };
@@ -1109,7 +1109,6 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
return { hasFirst, hasLast, nodes };
},
/* eslint-enable complexity */
getNativeAnonymousChildren: function(rawNode) {
// Get an anonymous walker and start on the first child.
@@ -1302,7 +1301,7 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
* @param string selectorState
* One of "pseudo", "id", "tag", "class", "null"
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
getSuggestionsForQuery: function(query, completing, selectorState) {
const sugs = {
classes: new Map(),
@@ -1444,7 +1443,6 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
suggestions: result,
};
},
/* eslint-enable complexity */
/**
* Add a pseudo-class lock to a node.

View File

@@ -1029,7 +1029,7 @@ NetworkObserver.prototype = {
* - total - the total time for all of the request and response.
* - timings - the HAR timings object.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
_setupHarTimings: function(httpActivity, fromCache) {
if (fromCache) {
// If it came from the browser cache, we have no timing
@@ -1270,7 +1270,6 @@ NetworkObserver.prototype = {
offsets: ot.offsets,
};
},
/* eslint-enable complexity */
_extractServerTimings: function(channel) {
if (!channel || !channel.serverTiming) {

View File

@@ -495,7 +495,7 @@ const proto = {
* An object that maps property names to safe getter descriptors as
* defined by the remote debugging protocol.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
_findSafeGetterValues: function(ownProperties, limit = 0) {
const safeGetterValues = Object.create(null);
let obj = this.obj;
@@ -599,7 +599,6 @@ const proto = {
return safeGetterValues;
},
/* eslint-enable complexity */
/**
* Find the safe getters for a given Debugger.Object. Safe getters are native

View File

@@ -425,7 +425,7 @@ function wrappedPrimitivePreviewer(
return true;
}
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function GenericObject(
objectActor,
grip,
@@ -529,7 +529,6 @@ function GenericObject(
return true;
}
/* eslint-enable complexity */
// Preview functions that do not rely on the object class.
previewers.Object = [
@@ -771,7 +770,7 @@ previewers.Object = [
return true;
},
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function DOMEvent({ obj, hooks }, grip, rawObj) {
if (isWorker || !rawObj || !Event.isInstance(rawObj)) {
return false;
@@ -864,7 +863,6 @@ previewers.Object = [
return true;
},
/* eslint-enable complexity */
function DOMException({ obj, hooks }, grip, rawObj) {
if (isWorker || !rawObj || obj.class !== "DOMException") {

View File

@@ -900,7 +900,7 @@ var cookieHelpers = {
* }
* }
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
editCookie(data) {
let { field, oldValue, newValue } = data;
const origName = field === "name" ? oldValue : data.items.name;
@@ -994,7 +994,6 @@ var cookieHelpers = {
cookie.sameSite
);
},
/* eslint-enable complexity */
_removeCookies(host, opts = {}) {
// We use a uniqueId to emulate compound keys for cookies. We need to
@@ -3445,7 +3444,7 @@ const StorageActor = protocol.ActorClassWithSpec(specs.storageSpec, {
* Pass an empty array if the host itself was affected: either completely
* removed or cleared.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
update(action, storeType, data) {
if (action == "cleared") {
this.emit("stores-cleared", { [storeType]: data });
@@ -3522,7 +3521,6 @@ const StorageActor = protocol.ActorClassWithSpec(specs.storageSpec, {
return null;
},
/* eslint-enable complexity */
/**
* This method removes data from the this.boundUpdate object in the same

View File

@@ -655,7 +655,7 @@ const WebConsoleActor = ActorClassWithSpec(webconsoleSpec, {
* @return object
* The response object which holds the startedListeners array.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
startListeners: async function(listeners) {
const startedListeners = [];
const window = !this.parentActor.isRootActor ? this.window : null;
@@ -826,7 +826,6 @@ const WebConsoleActor = ActorClassWithSpec(webconsoleSpec, {
traits: this.traits,
};
},
/* eslint-enable complexity */
/**
* Handler for the "stopListeners" request.
@@ -1135,7 +1134,7 @@ const WebConsoleActor = ActorClassWithSpec(webconsoleSpec, {
* @return object
* The evaluation response packet.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
evaluateJS: function(request) {
const input = request.text;
const timestamp = Date.now();
@@ -1323,7 +1322,6 @@ const WebConsoleActor = ActorClassWithSpec(webconsoleSpec, {
notes: errorNotes,
};
},
/* eslint-enable complexity */
/**
* The Autocomplete request handler.

View File

@@ -562,7 +562,7 @@ function mainThreadFetch(
).loadGroup;
}
/* eslint-disable complexity */
// eslint-disable-next-line complexity
const onResponse = (stream, status, request) => {
if (!components.isSuccessCode(status)) {
reject(new Error(`Failed to fetch ${url}. Code ${status}.`));

View File

@@ -284,7 +284,7 @@ function cssTrim(str) {
* rewriteDeclarations, and skip the usual name-checking
* heuristic.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function parseDeclarationsInternal(
isCssPropertyKnown,
inputString,
@@ -505,7 +505,6 @@ function parseDeclarationsInternal(
return declarations;
}
/* eslint-enable complexity */
/**
* Returns an array of CSS declarations given a string.
@@ -592,7 +591,7 @@ function parseNamedDeclarations(
* @return {Array} an array of objects with the following signature:
* [{ "value": string, "type": integer }, ...]
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function parsePseudoClassesAndAttributes(value) {
if (!value) {
throw new Error("empty input string");
@@ -678,7 +677,6 @@ function parsePseudoClassesAndAttributes(value) {
return result;
}
/* eslint-enable complexity */
/**
* Expects a single CSS value to be passed as the input and parses the value

View File

@@ -253,7 +253,7 @@ class WalkerFront extends FrontClassWithSpec(walkerSpec) {
/**
* Get any unprocessed mutation records and process them.
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
async getMutations(options = {}) {
const mutations = await super.getMutations(options);
const emitMutations = [];
@@ -410,7 +410,6 @@ class WalkerFront extends FrontClassWithSpec(walkerSpec) {
this.emit("mutations", emitMutations);
}
/* eslint-enable complexity */
/**
* Handle the `new-mutations` notification by fetching the

View File

@@ -207,7 +207,7 @@ function getLineCountInComments(text) {
* // between the original source and prettified source
* }
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function prettifyCSS(text, ruleCount) {
if (prettifyCSS.LINE_SEPARATOR == null) {
const os = Services.appinfo.OS;
@@ -475,7 +475,6 @@ function prettifyCSS(text, ruleCount) {
return { result, mappings };
}
/* eslint-enable complexity */
exports.prettifyCSS = prettifyCSS;

View File

@@ -50,7 +50,7 @@ exports.naturalSortCaseInsensitive = function naturalSortCaseInsensitive(a, b) {
* @param {Boolean} insensitive
* Should the search be case insensitive?
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function naturalSort(a, b, insensitive) {
// convert all to strings strip whitespace
const i = function(s) {
@@ -118,4 +118,3 @@ function naturalSort(a, b, insensitive) {
}
return null;
}
/* eslint-enable complexity */

View File

@@ -79,7 +79,7 @@ const MAX_AUTOCOMPLETIONS = (exports.MAX_AUTOCOMPLETIONS = 1500);
* access (e.g. `window["addEvent`).
* }
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function JSPropertyProvider({
dbgObject,
environment,
@@ -348,7 +348,6 @@ function JSPropertyProvider({
return prepareReturnedObject(getMatchedPropsInDbgObject(obj, search));
}
/* eslint-enable complexity */
function hasArrayIndex(str) {
return /\[\d+\]$/.test(str);
@@ -396,7 +395,7 @@ const OPERATOR_CHARS_SET = new Set(";,:=<>+-*%|&^~?!".split(""));
* element access (e.g. `x["match`).
* }
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
function analyzeInputString(str) {
// work variables.
const bodyStack = [];
@@ -598,7 +597,6 @@ function analyzeInputString(str) {
isElementAccess,
};
}
/* eslint-enable complexity */
/**
* For a given environment and constructor name, returns its Debugger.Object wrapped