Bug 1330791 - Enable the no-unreachable rule for eslint in /services and fix the associated errors. r=markh
☠☠ backed out by e34a208d8ac2 ☠ ☠
authorJared Wein <jwein@mozilla.com>
Thu, 12 Jan 2017 18:18:31 -0500
changeset 377090 25a6356de622a04b3cbd5bd83d15bbfa0442c75e
parent 377089 46f9c247550deabca94cbe67c68e92e8f25226ab
child 377091 b35cbfcd801f4ed7a13795aaeb3738c084f8af8d
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");