Bug 1330791 - Enable the no-unreachable rule for eslint in /services and fix the associated errors. r=markh
authorJared Wein <jwein@mozilla.com>
Thu, 12 Jan 2017 18:18:31 -0500
changeset 377610 b56d2b149310ce4e68737743e2f6358597c6c71a
parent 377609 2d05b9324d102cde14ff5a53a48d1510fe402bc9
child 377611 d22ec67cd6d68dde447b8cdf915d9fe65c94462e
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs1330791
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1330791 - Enable the no-unreachable rule for eslint in /services and fix the associated errors. r=markh MozReview-Commit-ID: e60hfjiUmS
services/.eslintrc.js
services/fxaccounts/FxAccountsClient.jsm
services/fxaccounts/FxAccountsPush.js
services/fxaccounts/tests/xpcshell/test_client.js
--- 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");