Bug 1330791 - Enable the brace-style rule for eslint in /services and fix the associated errors. r=markh

MozReview-Commit-ID: Ebl3bODX14z

--HG--
extra : rebase_source : 20fe1d8043b04c53b9521bc0ad30b72ebf253062
This commit is contained in:
Jared Wein 2017-01-12 18:24:52 -05:00
parent bcf58381e1
commit 285bebb13e
6 changed files with 22 additions and 33 deletions

View File

@ -8,7 +8,6 @@ module.exports = {
/* These rules are only set to warn temporarily
until they get fixed, at which point their
respective line in this file should be removed. */
"brace-style": "warn",
"consistent-return": "warn",
"no-cond-assign": "warn",
"no-ex-assign": "warn",

View File

@ -368,14 +368,12 @@ TokenServerClient.prototype = {
// invalid-generation.
error.message = "Authentication failed.";
error.cause = result.status;
}
// 403 should represent a "condition acceptance needed" response.
//
// The extra validation of "urls" is important. We don't want to signal
// conditions required unless we are absolutely sure that is what the
// server is asking for.
else if (response.status == 403) {
} else if (response.status == 403) {
// 403 should represent a "condition acceptance needed" response.
//
// The extra validation of "urls" is important. We don't want to signal
// conditions required unless we are absolutely sure that is what the
// server is asking for.
if (!("urls" in result)) {
this._log.warn("403 response without proper fields!");
this._log.warn("Response body: " + response.body);

View File

@ -929,15 +929,13 @@ SyncEngine.prototype = {
engines[this.name] = engineData;
metaGlobal.payload.engines = engines;
metaGlobal.changed = true;
}
// Don't sync this engine if the server has newer data
else if (engineData.version > this.version) {
} else if (engineData.version > this.version) {
// Don't sync this engine if the server has newer data
let error = new String("New data: " + [engineData.version, this.version]);
error.failureCode = VERSION_OUT_OF_DATE;
throw error;
}
// Changes to syncID mean we'll need to upload everything
else if (engineData.syncID != this.syncID) {
} else if (engineData.syncID != this.syncID) {
// Changes to syncID mean we'll need to upload everything
this._log.debug("Engine syncIDs: " + [engineData.syncID, this.syncID]);
this.syncID = engineData.syncID;
this._resetClient();

View File

@ -1047,17 +1047,15 @@ BookmarksTracker.prototype = {
if (PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.mobileFolderId, 0) == -1) {
if (mobile.length != 0)
PlacesUtils.bookmarks.removeItem(mobile[0], SOURCE_SYNC);
}
// Add the mobile bookmarks query if it doesn't exist
else if (mobile.length == 0) {
} else if (mobile.length == 0) {
// Add the mobile bookmarks query if it doesn't exist
let query = PlacesUtils.bookmarks.insertBookmark(all[0], queryURI, -1, title, /* guid */ null, SOURCE_SYNC);
PlacesUtils.annotations.setItemAnnotation(query, ORGANIZERQUERY_ANNO, MOBILE_ANNO, 0,
PlacesUtils.annotations.EXPIRE_NEVER, SOURCE_SYNC);
PlacesUtils.annotations.setItemAnnotation(query, PlacesUtils.EXCLUDE_FROM_BACKUP_ANNO, 1, 0,
PlacesUtils.annotations.EXPIRE_NEVER, SOURCE_SYNC);
}
// Make sure the existing query URL and title are correct
else {
} else {
// Make sure the existing query URL and title are correct
if (!PlacesUtils.bookmarks.getBookmarkURI(mobile[0]).equals(queryURI)) {
PlacesUtils.bookmarks.changeBookmarkURI(mobile[0], queryURI,
SOURCE_SYNC);

View File

@ -594,9 +594,8 @@ ClientEngine.prototype = {
if (!commandData) {
this._log.error("Unknown command to send: " + command);
return;
}
// Don't send a command with the wrong number of arguments.
else if (!args || args.length != commandData.args) {
} else if (!args || args.length != commandData.args) {
// Don't send a command with the wrong number of arguments.
this._log.error("Expected " + commandData.args + " args for '" +
command + "', but got " + args);
return;

View File

@ -1593,9 +1593,8 @@ Sync11Service.prototype = {
this.resetService();
engines = [this.clientsEngine].concat(this.engineManager.getAll());
}
// Convert the array of names into engines
else {
} else {
// Convert the array of names into engines
engines = this.engineManager.get(engines);
}
@ -1630,9 +1629,8 @@ Sync11Service.prototype = {
engines.forEach(function(e) {
this.clientsEngine.sendCommand("wipeEngine", [e]);
}, this);
}
// Tell the remote machines to wipe themselves.
else {
} else {
// Tell the remote machines to wipe themselves.
this.clientsEngine.sendCommand("wipeAll", []);
}
@ -1671,9 +1669,8 @@ Sync11Service.prototype = {
this.resetService();
engines = [this.clientsEngine].concat(this.engineManager.getAll());
}
// Convert the array of names into engines
else {
} else {
// Convert the array of names into engines
engines = this.engineManager.get(engines);
}