Bug 1330791 - Enable the no-unreachable rule for eslint in /services and fix the associated errors. r?markh
MozReview-Commit-ID: e60hfjiUmS
--- a/services/.eslintrc.js
+++ b/services/.eslintrc.js
@@ -12,11 +12,10 @@ module.exports = {
"consistent-return": "warn",
"no-cond-assign": "warn",
"no-ex-assign": "warn",
"no-func-assign": "warn",
"no-native-reassign": "warn",
"no-nested-ternary": "warn",
"no-octal": "warn",
"no-redeclare": "warn",
- "no-unreachable": "warn",
}
};
--- a/services/fxaccounts/FxAccountsClient.jsm
+++ b/services/fxaccounts/FxAccountsClient.jsm
@@ -338,24 +338,21 @@ this.FxAccountsClient.prototype = {
return this.signIn(email, "").then(
(cantHappen) => {
throw new Error("How did I sign in with an empty password?");
},
(expectedError) => {
switch (expectedError.errno) {
case ERRNO_ACCOUNT_DOES_NOT_EXIST:
return false;
- break;
case ERRNO_INCORRECT_PASSWORD:
return true;
- break;
default:
// not so expected, any more ...
throw expectedError;
- break;
}
}
);
},
/**
* Given the uid of an existing account (not an arbitrary email), ask
* the server if it still exists via /account/status.
--- a/services/fxaccounts/FxAccountsPush.js
+++ b/services/fxaccounts/FxAccountsPush.js
@@ -130,17 +130,16 @@ FxAccountsPushService.prototype = {
return this._onPushSubscriptionChange();
}
break;
case ONLOGOUT_NOTIFICATION:
// user signed out, we need to stop polling the Push Server
return this.unsubscribe().catch(err => {
this.log.error("Error during unsubscribe", err);
});
- break;
default:
break;
}
},
/**
* Wrapper around _observe that catches errors
*/
observe(subject, topic, data) {
@@ -164,21 +163,19 @@ FxAccountsPushService.prototype = {
let payload = message.data.json();
this.log.debug(`push command: ${payload.command}`);
switch (payload.command) {
case ON_DEVICE_CONNECTED_NOTIFICATION:
Services.obs.notifyObservers(null, ON_DEVICE_CONNECTED_NOTIFICATION, payload.data.deviceName);
break;
case ON_DEVICE_DISCONNECTED_NOTIFICATION:
return this.fxAccounts.handleDeviceDisconnection(payload.data.id);
- break;
case ON_PASSWORD_CHANGED_NOTIFICATION:
case ON_PASSWORD_RESET_NOTIFICATION:
return this._onPasswordChanged();
- break;
case ON_COLLECTION_CHANGED_NOTIFICATION:
Services.obs.notifyObservers(null, ON_COLLECTION_CHANGED_NOTIFICATION, payload.data.collections);
default:
this.log.warn("FxA Push command unrecognized: " + payload.command);
}
},
/**
* Check the FxA session status after a password change/reset event.
--- a/services/fxaccounts/tests/xpcshell/test_client.js
+++ b/services/fxaccounts/tests/xpcshell/test_client.js
@@ -613,17 +613,16 @@ add_task(function* test_accountExists()
// This will reject the client signIn promise
case "i.break.things@example.com":
response.setStatusLine(request.httpVersion, 500, "Alas");
response.bodyOutputStream.write(emptyMessage, emptyMessage.length);
break;
default:
throw new Error("Unexpected login from " + jsonBody.email);
- break;
}
},
});
let client = new FxAccountsClient(server.baseURI);
let result;
result = yield client.accountExists("i.exist@example.com");