Bug 1370232 - Enabled the ESLint no-unneeded-ternary rule across mozilla-central. r?Standard8 draft
authorRajesh Kathiriya <rajesh.kathiriya507@gmail.com>
Tue, 13 Jun 2017 00:23:54 +0530
changeset 593437 a19f4b1b16c9a556680008f7825c865d230f138f
parent 589687 c511ad826fe71ba2bb956d2e1c119e86d2266aba
child 633102 11e22a953d0d384cdbcc1bbbba6d5924eda6f45d
push id63686
push userbmo:rajesh.kathiriya507@gmail.com
push dateTue, 13 Jun 2017 14:34:58 +0000
reviewersStandard8
bugs1370232
milestone55.0a1
Bug 1370232 - Enabled the ESLint no-unneeded-ternary rule across mozilla-central. r?Standard8 MozReview-Commit-ID: AH9ArRkjh78
accessible/jsat/Presentation.jsm
accessible/tests/browser/.eslintrc.js
accessible/tests/mochitest/common.js
accessible/tests/mochitest/pivot.js
accessible/tests/mochitest/role/test_aria.html
browser/base/content/browser.js
browser/components/migration/.eslintrc.js
browser/components/places/PlacesUIUtils.jsm
browser/components/syncedtabs/TabListComponent.js
browser/extensions/formautofill/.eslintrc.js
dom/indexedDB/test/unit/test_indexes.js
dom/indexedDB/test/unit/test_indexes_funny_things.js
dom/indexedDB/test/unit/test_locale_aware_indexes.js
mobile/android/chrome/content/config.js
mobile/android/modules/geckoview/GeckoViewProgress.jsm
security/.eslintrc.js
toolkit/components/crashmonitor/test/unit/test_invalid_file.js
toolkit/components/extensions/.eslintrc.js
toolkit/components/jsdownloads/test/unit/common_test_Download.js
toolkit/components/narrate/.eslintrc.js
toolkit/components/places/tests/queries/head_queries.js
toolkit/components/telemetry/TelemetryEnvironment.jsm
toolkit/content/widgets/datetimebox.xml
toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
toolkit/mozapps/extensions/test/xpcshell/test_multiprocessCompatible.js
toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageOldVersionFailure.js
tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
--- a/accessible/jsat/Presentation.jsm
+++ b/accessible/jsat/Presentation.jsm
@@ -753,15 +753,14 @@ this.Presentation = { // jshint ignore:l
   noMove: function Presentation_noMove(aMoveMethod) {
     return this.presenters.map(p => p.noMove(aMoveMethod));
   },
 
   liveRegion: function Presentation_liveRegion(aAccessible, aIsPolite, aIsHide,
     aModifiedText) {
     let context;
     if (!aModifiedText) {
-      context = new PivotContext(aAccessible, null, -1, -1, true,
-        aIsHide ? true : false);
+      context = new PivotContext(aAccessible, null, -1, -1, true, !!aIsHide);
     }
     return this.presenters.map(p => p.liveRegion(context, aIsPolite, aIsHide,
                                                  aModifiedText));
   }
 };
--- a/accessible/tests/browser/.eslintrc.js
+++ b/accessible/tests/browser/.eslintrc.js
@@ -62,17 +62,16 @@ module.exports = {
     "no-sequences": "error",
     "no-shadow": "error",
     "no-space-before-semi": "off",
     "no-sync": "off",
     "no-ternary": "off",
     "no-throw-literal": "error",
     "no-underscore-dangle": "off",
     "no-undefined": "off",
-    "no-unneeded-ternary": "error",
     "no-unused-vars": ["error", {"vars": "all", "args": "none"}],
     "no-use-before-define": "off",
     "no-var": "off",
     "no-warning-comments": "off",
     "object-shorthand": "off",
     "one-var": ["error", "never"],
     "padded-blocks": ["error", "never"],
     "quote-props": "off",
--- a/accessible/tests/mochitest/common.js
+++ b/accessible/tests/mochitest/common.js
@@ -308,19 +308,18 @@ function getAccessible(aAccOrElmOrID, aI
 }
 
 /**
  * Return true if the given identifier has an accessible, or exposes the wanted
  * interfaces.
  */
 function isAccessible(aAccOrElmOrID, aInterfaces)
 {
-  return getAccessible(aAccOrElmOrID, aInterfaces, null,
-                       DONOTFAIL_IF_NO_ACC | DONOTFAIL_IF_NO_INTERFACE) ?
-    true : false;
+  return !!getAccessible(aAccOrElmOrID, aInterfaces, null,
+                         DONOTFAIL_IF_NO_ACC | DONOTFAIL_IF_NO_INTERFACE);
 }
 
 /**
  * Return an accessible that contains the DOM node for the given identifier.
  */
 function getContainerAccessible(aAccOrElmOrID)
 {
   var node = getNode(aAccOrElmOrID);
@@ -579,17 +578,17 @@ function testAccessibleTree(aAccOrElmOrI
 }
 
 /**
  * Return true if accessible for the given node is in cache.
  */
 function isAccessibleInCache(aNodeOrId)
 {
   var node = getNode(aNodeOrId);
-  return gAccService.getAccessibleFromCache(node) ? true : false;
+  return !!gAccService.getAccessibleFromCache(node);
 }
 
 /**
  * Test accessible tree for defunct accessible.
  *
  * @param  aAcc       [in] the defunct accessible
  * @param  aNodeOrId  [in] the DOM node identifier for the defunct accessible
  */
--- a/accessible/tests/mochitest/pivot.js
+++ b/accessible/tests/mochitest/pivot.js
@@ -277,17 +277,17 @@ function setVCTextInvoker(aDocAcc, aPivo
                           aIdOrNameOrAcc, aIsFromUserInput)
 {
   var expectMove = (aIdOrNameOrAcc != false);
   this.invoke = function virtualCursorChangedInvoker_invoke()
   {
     VCChangedChecker.storePreviousPosAndOffset(aDocAcc.virtualCursor);
     SimpleTest.info(aDocAcc.virtualCursor.position);
     var moved = aDocAcc.virtualCursor[aPivotMoveMethod](aBoundary,
-      aIsFromUserInput === undefined ? true : false);
+      aIsFromUserInput === undefined);
     SimpleTest.is(!!moved, !!expectMove,
                   "moved pivot by text with " + aPivotMoveMethod +
                   " to " + aIdOrNameOrAcc);
   };
 
   this.getID = function setVCPosInvoker_getID()
   {
     return "Do " + (expectMove ? "" : "no-op ") + aPivotMoveMethod + " in " +
--- a/accessible/tests/mochitest/role/test_aria.html
+++ b/accessible/tests/mochitest/role/test_aria.html
@@ -104,18 +104,17 @@
         testRole(weak_landmarks[l], ROLE_SECTION);
 
       for (l in weak_landmarks) {
         var id = weak_landmarks[l] + "_table";
         testRole(id, ROLE_TABLE);
         
         var accessibleTable = getAccessible(id, [nsIAccessibleTable], null,
                                             DONOTFAIL_IF_NO_INTERFACE);
-        ok(accessibleTable ? true : false,
-           "landmarked table should have nsIAccessibleTable");
+        ok(!!accessibleTable, "landmarked table should have nsIAccessibleTable");
         
         if (accessibleTable)
           is(accessibleTable.getCellAt(0,0).firstChild.name, "hi", "no cell");
       }
 
       //////////////////////////////////////////////////////////////////////////
       // test gEmptyRoleMap
       testRole("buttontable_row", ROLE_NOTHING);
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -7329,17 +7329,17 @@ var gIdentityHandler = {
     this._identityIconLabels.tooltipText = tooltip;
     this._identityIcon.tooltipText = gNavigatorBundle.getString("identity.icon.tooltip");
     this._identityIconLabel.value = icon_label;
     this._identityIconCountryLabel.value = icon_country_label;
     // Set cropping and direction
     this._identityIconLabel.crop = icon_country_label ? "end" : "center";
     this._identityIconLabel.parentNode.style.direction = icon_labels_dir;
     // Hide completely if the organization label is empty
-    this._identityIconLabel.parentNode.collapsed = icon_label ? false : true;
+    this._identityIconLabel.parentNode.collapsed = !icon_label;
   },
 
   /**
    * Set up the title and content messages for the identity message popup,
    * based on the specified mode, and the details of the SSL cert, where
    * applicable
    */
   refreshIdentityPopup() {
--- a/browser/components/migration/.eslintrc.js
+++ b/browser/components/migration/.eslintrc.js
@@ -16,17 +16,16 @@ module.exports = {
     "new-parens": "error",
     "no-extend-native": "error",
     "no-fallthrough": ["error", { "commentPattern": ".*[Ii]ntentional(?:ly)?\\s+fall(?:ing)?[\\s-]*through.*" }],
     "no-multi-str": "error",
     "no-return-assign": "error",
     "no-sequences": "error",
     "no-shadow": "error",
     "no-throw-literal": "error",
-    "no-unneeded-ternary": "error",
     "no-unused-vars": ["error", { "varsIgnorePattern": "^C[ciur]$" }],
     "padded-blocks": ["error", "never"],
     "semi": ["error", "always", {"omitLastInOneLineBlock": true }],
     "semi-spacing": ["error", {"before": false, "after": true}],
     "space-in-parens": ["error", "never"],
     "strict": ["error", "global"],
     "yoda": "error"
   }
--- a/browser/components/places/PlacesUIUtils.jsm
+++ b/browser/components/places/PlacesUIUtils.jsm
@@ -944,17 +944,17 @@ this.PlacesUIUtils = {
                   createInstance(Ci.nsIMutableArray);
       args.appendElement(uriList);
       browserWindow = Services.ww.openWindow(aWindow,
                                              "chrome://browser/content/browser.xul",
                                              null, "chrome,dialog=no,all", args);
       return;
     }
 
-    var loadInBackground = where == "tabshifted" ? true : false;
+    var loadInBackground = where == "tabshifted";
     // For consistency, we want all the bookmarks to open in new tabs, instead
     // of having one of them replace the currently focused tab.  Hence we call
     // loadTabs with aReplace set to false.
     browserWindow.gBrowser.loadTabs(urls, {
       inBackground: loadInBackground,
       replace: false,
       triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
     });
--- a/browser/components/syncedtabs/TabListComponent.js
+++ b/browser/components/syncedtabs/TabListComponent.js
@@ -123,17 +123,17 @@ TabListComponent.prototype = {
   onOpenTabs(urls, where) {
     if (!PlacesUIUtils.confirmOpenInTabs(urls.length, this._window)) {
       return;
     }
     if (where == "window") {
       this._window.openDialog(this._window.getBrowserURL(), "_blank",
                               "chrome,dialog=no,all", urls.join("|"));
     } else {
-      let loadInBackground = where == "tabshifted" ? true : false;
+      let loadInBackground = where == "tabshifted";
       this._getChromeWindow(this._window).gBrowser.loadTabs(urls, {
         inBackground: loadInBackground,
         replace: false,
         triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
       });
     }
     BrowserUITelemetry.countSyncedTabEvent("openmultiple", "sidebar");
   },
--- a/browser/extensions/formautofill/.eslintrc.js
+++ b/browser/extensions/formautofill/.eslintrc.js
@@ -113,19 +113,16 @@ module.exports = {
     // Disallow use of assignment in return statement. It is preferable for a
     // single line of code to have only one easily predictable effect.
     "no-return-assign": "error",
 
     // Disallow throwing literals (eg. throw "error" instead of
     // throw new Error("error")).
     "no-throw-literal": "error",
 
-    // Disallow the use of Boolean literals in conditional expressions.
-    "no-unneeded-ternary": "error",
-
     // Disallow padding within blocks.
     "padded-blocks": ["warn", "never"],
 
     // Require use of the second argument for parseInt().
     "radix": "error",
 
     // Enforce spacing after semicolons.
     "semi-spacing": ["error", {"before": false, "after": true}],
--- a/dom/indexedDB/test/unit/test_indexes.js
+++ b/dom/indexedDB/test/unit/test_indexes.js
@@ -94,18 +94,17 @@ function* testSteps()
         break;
       }
     }
     is(found, true, "objectStore has our index");
     let index = objectStore.index(indexData[i].name);
     is(index.name, indexData[i].name, "Correct name");
     is(index.objectStore.name, objectStore.name, "Correct store name");
     is(index.keyPath, indexData[i].keyPath, "Correct keyPath");
-    is(index.unique, indexData[i].options.unique ? true : false,
-       "Correct unique value");
+    is(index.unique, !!indexData[i].options.unique, "Correct unique value");
   }
 
   request = objectStore.index("name").getKey("Bob");
   request.onerror = errorHandler;
   request.onsuccess = grabEventAndContinueHandler;
   event = yield undefined;
 
   is(event.target.result, "237-23-7732", "Correct key returned!");
--- a/dom/indexedDB/test/unit/test_indexes_funny_things.js
+++ b/dom/indexedDB/test/unit/test_indexes_funny_things.js
@@ -90,18 +90,17 @@ function* testSteps()
         break;
       }
     }
     is(found, true, "objectStore has our index");
     let index = objectStore.index(indexData[i].name);
     is(index.name, indexData[i].name, "Correct name");
     is(index.objectStore.name, objectStore.name, "Correct store name");
     is(index.keyPath, indexData[i].keyPath, "Correct keyPath");
-    is(index.unique, indexData[i].options.unique ? true : false,
-       "Correct unique value");
+    is(index.unique, !!indexData[i].options.unique, "Correct unique value");
   }
 
   ok(true, "Test group 1");
 
   let keyIndex = 0;
 
   request = objectStore.index("type").openKeyCursor();
   request.onerror = errorHandler;
--- a/dom/indexedDB/test/unit/test_locale_aware_indexes.js
+++ b/dom/indexedDB/test/unit/test_locale_aware_indexes.js
@@ -94,18 +94,17 @@ function* testSteps()
         break;
       }
     }
     is(found, true, "objectStore has our index");
     let index = objectStore.index(indexData[i].name);
     is(index.name, indexData[i].name, "Correct name");
     is(index.objectStore.name, objectStore.name, "Correct store name");
     is(index.keyPath, indexData[i].keyPath, "Correct keyPath");
-    is(index.unique, indexData[i].options.unique ? true : false,
-       "Correct unique value");
+    is(index.unique, !!indexData[i].options.unique, "Correct unique value");
     if (indexData[i].options.locale == "auto") {
       is(index.isAutoLocale, true, "Correct isAutoLocale value");
       is(index.locale, "en_US", "Correct locale value");
     } else {
       is(index.isAutoLocale, false, "Correct isAutoLocale value");
       is(index.locale, indexData[i].options.locale, "Correct locale value");
     }
   }
--- a/mobile/android/chrome/content/config.js
+++ b/mobile/android/chrome/content/config.js
@@ -142,17 +142,17 @@ var NewPrefDialog = {
   // Changing an existing one on-the-fly, tap existing/displayed line item pref for that
   create: function AC_create(aEvent) {
     if (this._positiveButton.getAttribute("disabled") == "true") {
       return;
     }
 
     switch(this.type) {
       case "boolean":
-        Services.prefs.setBoolPref(this._prefNameInputElt.value, (this._booleanValue.value == "true") ? true : false);
+        Services.prefs.setBoolPref(this._prefNameInputElt.value, !!(this._booleanValue.value == "true"));
         break;
       case "string":
         Services.prefs.setCharPref(this._prefNameInputElt.value, this._stringValue.value);
         break;
       case "int":
         Services.prefs.setIntPref(this._prefNameInputElt.value, this._intValue.value);
         break;
     }
--- a/mobile/android/modules/geckoview/GeckoViewProgress.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewProgress.jsm
@@ -51,17 +51,17 @@ class GeckoViewProgress extends GeckoVie
         uri: uri.spec,
       };
 
       this.eventDispatcher.sendRequest(message);
     } else if ((aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) &&
                !aWebProgress.isLoadingDocument) {
       let message = {
         type: "GeckoView:PageStop",
-        success: aStatus ? false : true
+        success: !aStatus
       };
 
       this.eventDispatcher.sendRequest(message);
     }
   }
 
   onSecurityChange(aWebProgress, aRequest, aState) {
     debug("onSecurityChange()");
--- a/security/.eslintrc.js
+++ b/security/.eslintrc.js
@@ -85,19 +85,16 @@ module.exports = {
 
     // Disallow throwing literals (eg. |throw "error"| instead of
     // |throw new Error("error")|)
     "no-throw-literal": "error",
 
     // Disallow unmodified loop conditions.
     "no-unmodified-loop-condition": "error",
 
-    // Disallow ternary operators when simpler alternatives exist.
-    "no-unneeded-ternary": "error",
-
     // No expressions where a statement is expected
     "no-unused-expressions": "error",
 
     // Disallow unnecessary escape usage in strings and regular expressions.
     "no-useless-escape": "error",
 
     // Disallow whitespace before properties.
     "no-whitespace-before-property": "error",
--- a/toolkit/components/crashmonitor/test/unit/test_invalid_file.js
+++ b/toolkit/components/crashmonitor/test/unit/test_invalid_file.js
@@ -9,14 +9,14 @@
 add_task(async function test_invalid_file() {
   // Write bogus data to checkpoint file
   let data = "1234";
   await OS.File.writeAtomic(sessionCheckpointsPath, data,
                             {tmpPath: sessionCheckpointsPath + ".tmp"});
 
   // An invalid file will cause |init| to return null
   let status = await CrashMonitor.init();
-  do_check_true(status === null ? true : false);
+  do_check_true(!!(status === null));
 
   // and |previousCheckpoints| will be null
   let checkpoints = await CrashMonitor.previousCheckpoints;
-  do_check_true(checkpoints === null ? true : false);
+  do_check_true(!!(checkpoints === null));
 });
--- a/toolkit/components/extensions/.eslintrc.js
+++ b/toolkit/components/extensions/.eslintrc.js
@@ -272,19 +272,16 @@ module.exports = {
     "no-throw-literal": "error",
 
     // Allow dangling underscores in identifiers (for privates).
     "no-underscore-dangle": "off",
 
     // Allow use of undefined variable.
     "no-undefined": "off",
 
-    // Disallow the use of Boolean literals in conditional expressions.
-    "no-unneeded-ternary": "error",
-
     // We use var-only-at-top-level instead of no-var as we allow top level
     // vars.
     "no-var": "off",
 
     // Allow using TODO/FIXME comments.
     "no-warning-comments": "off",
 
     // Don't require method and property shorthand syntax for object literals.
--- a/toolkit/components/jsdownloads/test/unit/common_test_Download.js
+++ b/toolkit/components/jsdownloads/test/unit/common_test_Download.js
@@ -306,17 +306,17 @@ add_task(async function test_unix_permis
           await promiseDownloadStopped(download);
         }
 
         let isTemporary = launchWhenSucceeded && (autoDelete || isPrivate);
         let stat = await OS.File.stat(download.target.path);
         if (Services.appinfo.OS == "WINNT") {
           // On Windows
           // Temporary downloads should be read-only
-          do_check_eq(stat.winAttributes.readOnly, isTemporary ? true : false);
+          do_check_eq(stat.winAttributes.readOnly, !!isTemporary);
         } else {
           // On Linux, Mac
           // Temporary downloads should be read-only and not accessible to other
           // users, while permanently downloaded files should be readable and
           // writable as specified by the system umask.
           do_check_eq(stat.unixMode,
                       isTemporary ? 0o400 : (0o666 & ~OS.Constants.Sys.umask));
         }
--- a/toolkit/components/narrate/.eslintrc.js
+++ b/toolkit/components/narrate/.eslintrc.js
@@ -29,17 +29,16 @@ module.exports = {
     "no-mixed-spaces-and-tabs": "error",
     "no-multi-spaces": "warn",
     "no-multi-str": "warn",
     "no-multiple-empty-lines": ["warn", {"max": 1}],
     "no-return-assign": "error",
     "no-sequences": "error",
     "no-shadow": "warn",
     "no-throw-literal": "error",
-    "no-unneeded-ternary": "error",
     "no-unused-vars": "error",
     "padded-blocks": ["warn", "never"],
     "quotes": ["warn", "double", "avoid-escape"],
     "semi": ["warn", "always"],
     "semi-spacing": ["warn", {"before": false, "after": true}],
     "space-in-parens": ["warn", "never"],
     "strict": ["error", "global"],
     "yoda": "error"
--- a/toolkit/components/places/tests/queries/head_queries.js
+++ b/toolkit/components/places/tests/queries/head_queries.js
@@ -206,17 +206,17 @@ function queryData(obj) {
   this.lastVisit = obj.lastVisit ? obj.lastVisit : today;
   this.referrer = obj.referrer ? obj.referrer : null;
   this.transType = obj.transType ? obj.transType : Ci.nsINavHistoryService.TRANSITION_TYPED;
   this.isRedirect = obj.isRedirect ? obj.isRedirect : false;
   this.isDetails = obj.isDetails ? obj.isDetails : false;
   this.title = obj.title ? obj.title : "";
   this.markPageAsTyped = obj.markPageAsTyped ? obj.markPageAsTyped : false;
   this.isPageAnnotation = obj.isPageAnnotation ? obj.isPageAnnotation : false;
-  this.removeAnnotation = obj.removeAnnotation ? true : false;
+  this.removeAnnotation = !!obj.removeAnnotation;
   this.annoName = obj.annoName ? obj.annoName : "";
   this.annoVal = obj.annoVal ? obj.annoVal : "";
   this.annoFlags = obj.annoFlags ? obj.annoFlags : 0;
   this.annoExpiration = obj.annoExpiration ? obj.annoExpiration : 0;
   this.isItemAnnotation = obj.isItemAnnotation ? obj.isItemAnnotation : false;
   this.itemId = obj.itemId ? obj.itemId : 0;
   this.annoMimeType = obj.annoMimeType ? obj.annoMimeType : "";
   this.isTag = obj.isTag ? obj.isTag : false;
--- a/toolkit/components/telemetry/TelemetryEnvironment.jsm
+++ b/toolkit/components/telemetry/TelemetryEnvironment.jsm
@@ -1232,17 +1232,17 @@ EnvironmentCache.prototype = {
       } catch (ex) {
         this._log.error("_isDefaultBrowser - Could not obtain shell service", ex);
         return null;
       }
     }
 
     try {
       // This uses the same set of flags used by the pref pane.
-      return shellService.isDefaultBrowser(false, true) ? true : false;
+      return !!shellService.isDefaultBrowser(false, true);
     } catch (ex) {
       this._log.error("_isDefaultBrowser - Could not determine if default browser", ex);
       return null;
     }
   },
 
   /**
    * Update the cached settings data.
--- a/toolkit/content/widgets/datetimebox.xml
+++ b/toolkit/content/widgets/datetimebox.xml
@@ -1646,17 +1646,17 @@
               let targetField = aEvent.originalTarget;
               this.clearFieldValue(targetField);
               this.setInputValueFromFields();
               aEvent.preventDefault();
               break;
             }
             case "ArrowRight":
             case "ArrowLeft": {
-              this.advanceToNextField(aEvent.key == "ArrowRight" ? false : true);
+              this.advanceToNextField(!(aEvent.key == "ArrowRight"));
               aEvent.preventDefault();
               break;
             }
             case "ArrowUp":
             case "ArrowDown":
             case "PageUp":
             case "PageDown":
             case "Home":
--- a/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
@@ -15,18 +15,17 @@ var gCategoryUtilities;
 
 var gMockAddons = [];
 
 for (let plugin of GMPScope.GMP_PLUGINS) {
   let mockAddon = Object.freeze({
       id: plugin.id,
       isValid: true,
       isInstalled: false,
-      isEME: (plugin.id == "gmp-widevinecdm" ||
-              plugin.id.indexOf("gmp-eme-") == 0) ? true : false,
+      isEME: !!(plugin.id == "gmp-widevinecdm" || plugin.id.indexOf("gmp-eme-") == 0),
   });
   gMockAddons.push(mockAddon);
 }
 
 var gInstalledAddonId = "";
 var gInstallDeferred = null;
 var gPrefs = Services.prefs;
 var getKey = GMPScope.GMPPrefs.getPrefKey;
--- a/toolkit/mozapps/extensions/test/xpcshell/test_multiprocessCompatible.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_multiprocessCompatible.js
@@ -160,17 +160,17 @@ add_task(async function test_disable() {
     do_check_neq(addon2, null);
     do_check_eq(addon2.multiprocessCompatible, false);
     do_check_eq(addon2.appDisabled, initialAllow === false);
 
     do_check_neq(addon3, null);
     do_check_eq(addon3.appDisabled, false);
 
     // Flip the allow-non-mpc preference
-    let newValue = (initialAllow === true) ? false : true;
+    let newValue = !(initialAllow === true);
     Services.prefs.setBoolPref(NON_MPC_PREF, newValue);
 
     // the mpc extension should never become appDisabled
     do_check_eq(addon1.appDisabled, false);
 
     // The non-mpc extension should become disabled if we don't allow non-mpc
     do_check_eq(addon2.appDisabled, !newValue);
 
--- a/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
+++ b/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
@@ -820,18 +820,17 @@ function setupTestCommon() {
       gTestID += "_new";
       logTestInfo("using a new directory for the test by changing gTestID " +
                   "since there is an existing test directory that can't be " +
                   "removed, gTestID: " + gTestID);
     }
   }
 
   if (IS_WIN) {
-    Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED,
-                               IS_SERVICE_TEST ? true : false);
+    Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, !!IS_SERVICE_TEST);
   }
 
   // adjustGeneralPaths registers a cleanup function that calls end_test when
   // it is defined as a function.
   adjustGeneralPaths();
   // Logged once here instead of in the mock directory provider to lessen test
   // log spam.
   debugDump("Updates Directory (UpdRootD) Path: " + getMockUpdRootD().path);
--- a/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageOldVersionFailure.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageOldVersionFailure.js
@@ -61,17 +61,17 @@ function runUpdateFinished() {
   Assert.ok(!gUpdateManager.activeUpdate,
             "the active update should not be defined");
   Assert.equal(gUpdateManager.updateCount, 2,
                "the update manager updateCount attribute" + MSG_SHOULD_EQUAL);
   Assert.equal(gUpdateManager.getUpdateAt(0).state, STATE_AFTER_STAGE,
                "the update state" + MSG_SHOULD_EQUAL);
   checkPostUpdateRunningFile(false);
   setTestFilesAndDirsForFailure();
-  checkFilesAfterUpdateFailure(getApplyDirFile, IS_MACOSX ? false : true, false);
+  checkFilesAfterUpdateFailure(getApplyDirFile, !IS_MACOSX, false);
 
   let updatesDir = getUpdatesPatchDir();
   Assert.ok(updatesDir.exists(),
             MSG_SHOULD_EXIST + getMsgPath(updatesDir.path));
 
   let log = getUpdateLog(FILE_UPDATE_LOG);
   Assert.ok(!log.exists(),
             MSG_SHOULD_NOT_EXIST + getMsgPath(log.path));
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
@@ -266,16 +266,19 @@ module.exports = {
     "no-trailing-spaces": "error",
 
     // No using undeclared variables
     "no-undef": "error",
 
     // Error on newline where a semicolon is needed
     "no-unexpected-multiline": "error",
 
+    // Disallow the use of Boolean literals in conditional expressions.
+    "no-unneeded-ternary": "error",
+
     // No unreachable statements
     "no-unreachable": "error",
 
     // Disallow control flow statements in finally blocks
     "no-unsafe-finally": "error",
 
     // No (!foo in bar) or (!object instanceof Class)
     "no-unsafe-negation": "error",