Bug 1330791 - Enable the no-unreachable rule for eslint in /services and fix the associated errors. r?markh draft
authorJared Wein <jwein@mozilla.com>
Thu, 12 Jan 2017 18:18:31 -0500
changeset 462293 64431474f1ce936e901a509d31cbe05675702e26
parent 462292 23427181ad52ecd50467679d5fabb14672083c4c
child 462294 214cb0cd488a4b4e40fd3b3564cc4d52fb59b3c5
push id41685
push userbmo:jaws@mozilla.com
push dateMon, 16 Jan 2017 21:58:09 +0000
reviewersmarkh
bugs1330791
milestone53.0a1
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");