Bug 1452575 - Enable ESLint for devtools/client/shared/**/*.jsm. r=jryans

MozReview-Commit-ID: G7g94FkBbhp

--HG--
extra : rebase_source : 4dac1e2422ca429d28a58a020317d3daf417d9a6
This commit is contained in:
Mark Banner 2018-04-09 11:14:01 +01:00
parent d3608825b8
commit a0fd02b723
8 changed files with 38 additions and 46 deletions

View file

@ -106,20 +106,10 @@ devtools/client/inspector/rules/test/doc_media_queries.html
devtools/client/memory/test/chrome/*.html
devtools/client/performance/components/test/test_jit_optimizations_01.html
devtools/client/responsive.html/test/browser/touch.html
devtools/client/shared/*.jsm
devtools/client/shared/components/reps/reps.js
devtools/client/shared/components/reps/test/mochitest/*.html
!devtools/client/shared/components/reps/test/mochitest/test_reps_infinity.html
!devtools/client/shared/components/reps/test/mochitest/test_reps_nan.html
!devtools/client/shared/components/reps/test/mochitest/test_reps_promise.html
!devtools/client/shared/components/reps/test/mochitest/test_reps_symbol.html
!devtools/client/shared/components/reps/test/mochitest/test_reps_text-node.html
devtools/client/shared/components/test/mochitest/*.html
!devtools/client/shared/components/test/mochitest/test_stack-trace.html
devtools/client/shared/shim/test/test_*.html
devtools/client/shared/test/browser_toolbar_webconsole_errors_count.html
devtools/client/shared/webgl-utils.js
devtools/client/shared/widgets/*.jsm
devtools/client/storage/test/*.html
!devtools/client/storage/test/storage-cookies.html
!devtools/client/storage/test/storage-overflow.html
@ -150,6 +140,7 @@ devtools/client/debugger/**
# Ignore devtools imported repositories
devtools/client/debugger/new/**
devtools/client/shared/components/reps/**
# Ignore devtools preferences files
devtools/client/preferences/**

View file

@ -36,6 +36,7 @@ module.exports = {
"files": [
"client/scratchpad/scratchpad-manager.jsm",
"client/scratchpad/scratchpad.js",
"client/shared/*.jsm",
],
"rules": {
"camelcase": "off",
@ -44,6 +45,8 @@ module.exports = {
"files": [
"client/framework/**",
"client/scratchpad/**",
"client/shared/*.jsm",
"client/shared/widgets/*.jsm",
],
"rules": {
"consistent-return": "off",
@ -52,6 +55,7 @@ module.exports = {
"files": [
"client/framework/**",
"client/scratchpad/**",
"client/shared/AppCacheUtils.jsm",
],
"rules": {
"max-nested-callbacks": "off",
@ -60,6 +64,8 @@ module.exports = {
"files": [
"client/framework/**",
"client/scratchpad/**",
"client/shared/*.jsm",
"client/shared/widgets/*.jsm",
],
"rules": {
"max-len": "off",
@ -76,6 +82,8 @@ module.exports = {
"files": [
"client/framework/**",
"client/scratchpad/**",
"client/shared/*.jsm",
"client/shared/widgets/*.jsm",
],
"rules": {
"mozilla/no-aArgs": "off",
@ -92,6 +100,8 @@ module.exports = {
"files": [
"client/framework/**",
"client/scratchpad/**",
"client/shared/AppCacheUtils.jsm",
"client/shared/widgets/*.jsm",
],
"rules": {
"no-shadow": "off",

View file

@ -31,7 +31,6 @@ var { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {}
var { gDevTools } = require("devtools/client/framework/devtools");
var Services = require("Services");
var promise = require("promise");
this.EXPORTED_SYMBOLS = ["AppCacheUtils"];
@ -184,7 +183,7 @@ AppCacheUtils.prototype = {
let inputStream = Cc["@mozilla.org/scriptableinputstream;1"]
.createInstance(Ci.nsIScriptableInputStream);
let buffer = "";
var channel = NetUtil.newChannel({
let channel = NetUtil.newChannel({
uri: uri,
loadUsingSystemPrincipal: true,
securityFlags: Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL
@ -288,9 +287,7 @@ AppCacheUtils.prototype = {
},
viewEntry: function ACU_viewEntry(key) {
let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
let win = wm.getMostRecentWindow(gDevTools.chromeWindowType);
let win = Services.wm.getMostRecentWindow(gDevTools.chromeWindowType);
let url = "about:cache-entry?storage=appcache&context=&eid=&uri=" + key;
win.openUILinkIn(url, "tab");
},

View file

@ -86,8 +86,8 @@ DOMHelpers.prototype = {
}
let child = null;
if (previousSibling) // then we are walking
{
if (previousSibling) {
// then we are walking
child = this.getNextSibling(previousSibling);
} else {
child = this.getFirstChild(node);

View file

@ -6,7 +6,6 @@
"use strict";
const { require, loader } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
const { ViewHelpers } = require("devtools/client/shared/widgets/view-helpers");
const { KeyCodes } = require("devtools/client/shared/keycodes");
@ -376,11 +375,10 @@ AbstractTreeItem.prototype = {
// it is safe to append everything at once.
if (this == this._rootItem && this.autoExpandDepth == 0) {
this._appendChildrenBatch();
}
// Otherwise, append the child items and their descendants successively;
// if not, the tree will become garbled and nodes will intertwine,
// since all the tree items are sharing a single container node.
else {
} else {
// Otherwise, append the child items and their descendants successively;
// if not, the tree will become garbled and nodes will intertwine,
// since all the tree items are sharing a single container node.
this._appendChildrenSuccessive();
}
},

View file

@ -173,7 +173,6 @@ SideMenuWidget.prototype = {
* Removes all of the child nodes from this container.
*/
removeAllItems: function() {
let parent = this._parent;
let list = this._list;
while (list.hasChildNodes()) {
@ -486,9 +485,8 @@ function SideMenuGroup(aWidget, aName, aOptions = {}) {
title.appendChild(name);
target.appendChild(title);
target.appendChild(list);
}
// Skip a few redundant nodes when no title is shown.
else {
} else {
// Skip a few redundant nodes when no title is shown.
let target = this._target = this._list = this.document.createElement("vbox");
target.className = "side-menu-widget-group side-menu-widget-group-list";
target.setAttribute("merged-group-contents", "");
@ -596,9 +594,8 @@ function SideMenuItem(aGroup, aContents, aAttachment = {}, aOptions = {}) {
arrow.className = "side-menu-widget-item-arrow";
container.appendChild(arrow);
}
}
// Skip a few redundant nodes when no horizontal arrow or checkbox is shown.
else {
} else {
// Skip a few redundant nodes when no horizontal arrow or checkbox is shown.
let target = this._target = this._container = this.document.createElement("hbox");
target.className = "side-menu-widget-item side-menu-widget-item-contents";
target.setAttribute("merged-item-contents", "");

View file

@ -1163,13 +1163,11 @@ VariablesView.getterOrSetterEvalMacro = function(aItem, aCurrentString, aPrefix
// standard function definition syntax
if (aCurrentString.includes("return ")) {
body = "{" + aCurrentString + "}";
}
// If block syntax is used, use the whole string as the function body.
else if (aCurrentString.startsWith("{")) {
} else if (aCurrentString.startsWith("{")) {
// If block syntax is used, use the whole string as the function body.
body = aCurrentString;
}
// Prefer an expression closure.
else {
} else {
// Prefer an expression closure.
body = "(" + aCurrentString + ")";
}
aCurrentString = header + body;
@ -1915,9 +1913,8 @@ Scope.prototype = {
if (!lowerCaseName.includes(aLowerCaseQuery) &&
!lowerCaseValue.includes(aLowerCaseQuery)) {
variable._matched = false;
}
// Variable or property is matched.
else {
} else {
// Variable or property is matched.
variable._matched = true;
// If the variable was ever expanded, there's a possibility it may
@ -2569,10 +2566,9 @@ Variable.prototype = extend(Scope.prototype, {
if (this.ownerView.eval) {
this.delete = VariablesView.getterOrSetterDeleteCallback;
this.evaluationMacro = VariablesView.overrideValueEvalMacro;
}
// Deleting getters and setters individually is not allowed if no
// evaluation method is provided.
else {
} else {
// Deleting getters and setters individually is not allowed if no
// evaluation method is provided.
this.delete = null;
this.evaluationMacro = null;
}
@ -3339,10 +3335,12 @@ VariablesView.getGrip = function(aValue) {
if (aValue === undefined) {
return { type: "undefined" };
}
// fall through
case "object":
if (aValue === null) {
return { type: "null" };
}
// fall through
case "function":
return { type: "object",
class: WebConsoleUtils.getObjectClassName(aValue) };
@ -3407,6 +3405,7 @@ VariablesView.getString = function(aGrip, aOptions = {}) {
if (!aGrip && 1 / aGrip === -Infinity) {
return "-0";
}
// fall through
default:
return aGrip + "";
}

View file

@ -509,6 +509,7 @@ VariablesViewController.prototype = {
let objGrip = grip.obj;
let objectClient = this._getObjectClient(objGrip);
// eslint-disable-next-line new-cap
return new promise((resolve, reject) => {
objectClient.enumEntries((response) => {
if (response.error) {
@ -827,9 +828,8 @@ var StackFrameUtils = this.StackFrameUtils = {
// Name the outermost scope Global.
if (!aEnv.parent) {
name = L10N.getStr("globalScopeLabel");
}
// Otherwise construct the scope name.
else {
} else {
// Otherwise construct the scope name.
name = aEnv.type.charAt(0).toUpperCase() + aEnv.type.slice(1);
}