Bug 1655400 - Enable ESLint rule no-setter-return for all of places. r=Standard8
authorSonia Singla <soniasingla.1812@gmail.com>
Wed, 29 Jul 2020 11:19:09 +0000
changeset 542435 3b87c49182a4f435447a4f9147c1db7d496ecb11
parent 542434 664d5871886be87c7e0dc71c0179ce0885c1c951
child 542436 eb9de49e4f7d634cf97d9a7efc3d6ded65c58e3f
push id37649
push userabutkovits@mozilla.com
push dateWed, 29 Jul 2020 15:56:31 +0000
treeherdermozilla-central@3b87c49182a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs1655400
milestone81.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 1655400 - Enable ESLint rule no-setter-return for all of places. r=Standard8 Differential Revision: https://phabricator.services.mozilla.com/D85021
.eslintrc.js
browser/components/places/content/browserPlacesViews.js
browser/components/places/content/controller.js
browser/components/places/content/places-menupopup.js
browser/components/places/content/places-tree.js
browser/components/places/content/places.js
browser/components/places/content/treeView.js
toolkit/components/places/PlacesExpiration.jsm
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -950,22 +950,16 @@ module.exports = {
         "browser/base/content/tabbrowser-tabs.js",
         "browser/base/content/tabbrowser.js",
         "browser/components/downloads/DownloadsCommon.jsm",
         "browser/components/downloads/content/allDownloadsView.js",
         "browser/components/downloads/content/downloads.js",
         "browser/components/downloads/content/indicator.js",
         "browser/components/payments/res/components/csc-input.js",
         "browser/components/payments/res/components/labelled-checkbox.js",
-        "browser/components/places/content/browserPlacesViews.js",
-        "browser/components/places/content/controller.js",
-        "browser/components/places/content/places-menupopup.js",
-        "browser/components/places/content/places-tree.js",
-        "browser/components/places/content/places.js",
-        "browser/components/places/content/treeView.js",
         "browser/components/pocket/content/Pocket.jsm",
         "browser/components/preferences/search.js",
         "browser/components/search/content/search-one-offs.js",
         "browser/components/search/content/searchbar.js",
         "browser/components/sessionstore/ContentSessionStore.jsm",
         "browser/components/urlbar/UrlbarInput.jsm",
         "browser/components/urlbar/UrlbarView.jsm",
         "browser/extensions/formautofill/content/customElements.js",
@@ -979,17 +973,16 @@ module.exports = {
         "mobile/android/modules/geckoview/DelayedInit.jsm",
         "services/sync/modules/record.js",
         "toolkit/actors/AutoCompleteChild.jsm",
         "toolkit/components/autocomplete/tests/unit/test_stopSearch.js",
         "toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm",
         "toolkit/components/extensions/ExtensionParent.jsm",
         "toolkit/components/osfile/modules/osfile_async_front.jsm",
         "toolkit/components/osfile/modules/osfile_shared_allthreads.jsm",
-        "toolkit/components/places/PlacesExpiration.jsm",
         "toolkit/content/aboutSupport.js",
         "toolkit/content/customElements.js",
         "toolkit/content/preferencesBindings.js",
         "toolkit/content/tests/chrome/test_custom_element_base.xhtml",
         "toolkit/content/viewZoomOverlay.js",
         "toolkit/content/widgets/*.js",
         "toolkit/modules/NewTabUtils.jsm",
         "toolkit/modules/tests/modules/Task.jsm",
--- a/browser/components/places/content/browserPlacesViews.js
+++ b/browser/components/places/content/browserPlacesViews.js
@@ -58,26 +58,25 @@ PlacesViewBase.prototype = {
     this._place = val;
 
     let history = PlacesUtils.history;
     let query = {},
       options = {};
     history.queryStringToQuery(val, query, options);
     let result = history.executeQuery(query.value, options.value);
     result.addObserver(this);
-    return val;
   },
 
   _result: null,
   get result() {
     return this._result;
   },
   set result(val) {
     if (this._result == val) {
-      return val;
+      return;
     }
 
     if (this._result) {
       this._result.removeObserver(this);
       this._resultNode.containerOpen = false;
     }
 
     if (this._rootElt.localName == "menupopup") {
@@ -92,35 +91,31 @@ PlacesViewBase.prototype = {
       this._domNodes.set(this._resultNode, this._rootElt);
 
       // This calls _rebuild through invalidateContainer.
       this._resultNode.containerOpen = true;
     } else {
       this._resultNode = null;
       delete this._domNodes;
     }
-
-    return val;
   },
 
   _options: null,
   get options() {
     return this._options;
   },
   set options(val) {
     if (!val) {
       val = {};
     }
 
     if (!("extraClasses" in val)) {
       val.extraClasses = {};
     }
     this._options = val;
-
-    return val;
   },
 
   /**
    * Gets the DOM node used for the given places node.
    *
    * @param aPlacesNode
    *        a places result node.
    * @param aAllowMissing
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -41,17 +41,17 @@ function PlacesInsertionPoint({
   this._index = index;
   this.orientation = orientation;
   this.tagName = tagName;
   this.dropNearNode = dropNearNode;
 }
 
 PlacesInsertionPoint.prototype = {
   set index(val) {
-    return (this._index = val);
+    this._index = val;
   },
 
   async getIndex() {
     if (this.dropNearNode) {
       // If dropNearNode is set up we must calculate the index of the item near
       // which we will drop.
       let index = (
         await PlacesUtils.bookmarks.fetch(this.dropNearNode.bookmarkGuid)
@@ -1170,17 +1170,16 @@ PlacesController.prototype = {
       self._cutNodes.forEach(function(aNode) {
         self._view.toggleCutNode(aNode, aValue);
       });
     }
 
     updateCutNodes(false);
     this._cutNodes = aNodes;
     updateCutNodes(true);
-    return aNodes;
   },
 
   /**
    * Copy Bookmarks and Folders to the clipboard
    */
   copy: function PC_copy() {
     let result = this._view.result;
     let didSuppressNotifications = result.suppressNotifications;
--- a/browser/components/places/content/places-menupopup.js
+++ b/browser/components/places/content/places-menupopup.js
@@ -67,45 +67,45 @@
           closeTimer: null,
         },
         _closeMenuTimer: null,
 
         get elt() {
           return this._folder.elt;
         },
         set elt(val) {
-          return (this._folder.elt = val);
+          this._folder.elt = val;
         },
 
         get openTimer() {
           return this._folder.openTimer;
         },
         set openTimer(val) {
-          return (this._folder.openTimer = val);
+          this._folder.openTimer = val;
         },
 
         get hoverTime() {
           return this._folder.hoverTime;
         },
         set hoverTime(val) {
-          return (this._folder.hoverTime = val);
+          this._folder.hoverTime = val;
         },
 
         get closeTimer() {
           return this._folder.closeTimer;
         },
         set closeTimer(val) {
-          return (this._folder.closeTimer = val);
+          this._folder.closeTimer = val;
         },
 
         get closeMenuTimer() {
           return this._closeMenuTimer;
         },
         set closeMenuTimer(val) {
-          return (this._closeMenuTimer = val);
+          this._closeMenuTimer = val;
         },
 
         setTimer: function OF__setTimer(aTime) {
           var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
           timer.initWithCallback(this, aTime, timer.TYPE_ONE_SHOT);
           return timer;
         },
 
--- a/browser/components/places/content/places-tree.js
+++ b/browser/components/places/content/places-tree.js
@@ -145,35 +145,33 @@
     }
 
     set disableUserActions(val) {
       if (val) {
         this.setAttribute("disableUserActions", "true");
       } else {
         this.removeAttribute("disableUserActions");
       }
-      return val;
     }
 
     get disableUserActions() {
       return this.getAttribute("disableUserActions") == "true";
     }
     /**
      * overriding
      */
     set view(val) {
       // We save the view so that we can avoid expensive get calls when
       // we need to get the view again.
       this._view = val;
-      /* eslint-disable no-undef */
-      return Object.getOwnPropertyDescriptor(
+      Object.getOwnPropertyDescriptor(
+        // eslint-disable-next-line no-undef
         XULTreeElement.prototype,
         "view"
       ).set.call(this, val);
-      /* eslint-enable no-undef */
     }
 
     get view() {
       return this._view;
     }
 
     get associatedElement() {
       return this;
@@ -183,17 +181,16 @@
       if (this.flatList != val) {
         this.setAttribute("flatList", val);
         // reload with the last place set
         if (this.place) {
           // eslint-disable-next-line no-self-assign
           this.place = this.place;
         }
       }
-      return val;
     }
 
     get flatList() {
       return this.getAttribute("flatList") == "true";
     }
 
     /**
      * nsIPlacesView
@@ -210,18 +207,16 @@
      */
     set place(val) {
       this.setAttribute("place", val);
 
       let query = {},
         options = {};
       PlacesUtils.history.queryStringToQuery(val, query, options);
       this.load(query.value, options.value);
-
-      return val;
     }
 
     get place() {
       return this.getAttribute("place");
     }
     /**
      * nsIPlacesView
      */
@@ -404,17 +399,17 @@
       return this._cachedInsertionPoint;
     }
 
     get ownerWindow() {
       return window;
     }
 
     set active(val) {
-      return (this._active = val);
+      this._active = val;
     }
 
     get active() {
       return this._active;
     }
 
     applyFilter(filterString, folderRestrict, includeHidden) {
       // preserve grouping
--- a/browser/components/places/content/places.js
+++ b/browser/components/places/content/places.js
@@ -272,17 +272,17 @@ var PlacesOrganizer = {
 
   _location: null,
   get location() {
     return this._location;
   },
 
   set location(aLocation) {
     if (!aLocation || this._location == aLocation) {
-      return aLocation;
+      return;
     }
 
     if (this.location) {
       this._backHistory.unshift(this.location);
       this._forwardHistory.splice(0, this._forwardHistory.length);
     }
 
     this._location = aLocation;
@@ -308,18 +308,16 @@ var PlacesOrganizer = {
       document
         .getElementById("OrganizerCommand:Forward")
         .setAttribute("disabled", true);
     } else {
       document
         .getElementById("OrganizerCommand:Forward")
         .removeAttribute("disabled");
     }
-
-    return aLocation;
   },
 
   _backHistory: [],
   _forwardHistory: [],
 
   back: function PO_back() {
     this._forwardHistory.unshift(this.location);
     var historyEntry = this._backHistory.shift();
@@ -833,17 +831,16 @@ var PlacesSearchBox = {
   get folders() {
     if (!this._folders.length) {
       this._folders = PlacesUtils.bookmarks.userContentRoots;
     }
     return this._folders;
   },
   set folders(aFolders) {
     this._folders = aFolders;
-    return aFolders;
   },
 
   /**
    * Run a search for the specified text, over the collection specified by
    * the dropdown arrow. The default is all bookmarks, but can be
    * localized to the active collection.
    * @param   filterString
    *          The text to search for.
@@ -942,23 +939,21 @@ var PlacesSearchBox = {
   /**
    * Gets/sets the active collection from the dropdown menu.
    */
   get filterCollection() {
     return this.searchFilter.getAttribute("collection");
   },
   set filterCollection(collectionName) {
     if (collectionName == this.filterCollection) {
-      return collectionName;
+      return;
     }
 
     this.searchFilter.setAttribute("collection", collectionName);
     this.updateCollectionTitle();
-
-    return collectionName;
   },
 
   /**
    * Focus the search box
    */
   focus: function PSB_focus() {
     this.searchFilter.focus();
   },
@@ -972,17 +967,17 @@ var PlacesSearchBox = {
 
   /**
    * Gets or sets the text shown in the Places Search Box
    */
   get value() {
     return this.searchFilter.value;
   },
   set value(value) {
-    return (this.searchFilter.value = value);
+    this.searchFilter.value = value;
   },
 };
 
 /**
  * Functions and data for advanced query builder
  */
 var PlacesQueryBuilder = {
   queries: [],
@@ -1375,33 +1370,31 @@ var ContentArea = {
       this._deck.selectedPanel = aNewView.associatedElement;
 
       // If the content area inactivated view was focused, move focus
       // to the new view.
       if (document.activeElement == oldView.associatedElement) {
         aNewView.associatedElement.focus();
       }
     }
-    return aNewView;
   },
 
   get currentPlace() {
     return this.currentView.place;
   },
   set currentPlace(aQueryString) {
     let oldView = this.currentView;
     let newView = this.getContentViewForQueryString(aQueryString);
     newView.place = aQueryString;
     if (oldView != newView) {
       oldView.active = false;
       this.currentView = newView;
       this._setupView();
       newView.active = true;
     }
-    return aQueryString;
   },
 
   /**
    * Applies view options.
    */
   _setupView: function CA__setupView() {
     let options = this.currentViewOptions;
 
--- a/browser/components/places/content/treeView.js
+++ b/browser/components/places/content/treeView.js
@@ -1205,18 +1205,16 @@ PlacesTreeView.prototype = {
       delete this._cellProperties;
       delete this._cuttingNodes;
     }
 
     // If the tree is not set yet, setTree will call finishInit.
     if (this._tree && val) {
       this._finishInit();
     }
-
-    return val;
   },
 
   /**
    * This allows you to get at the real node for a given row index. This is
    * only valid when a tree is attached.
    *
    * @param {Integer} aIndex The index for the node to get.
    * @return {Ci.nsINavHistoryResultNode} The node.
--- a/toolkit/components/places/PlacesExpiration.jsm
+++ b/toolkit/components/places/PlacesExpiration.jsm
@@ -754,17 +754,16 @@ nsPlacesExpiration.prototype = {
     if (aNewStatus != this._status) {
       // If status changes we should restart the timer.
       this._status = aNewStatus;
       this._newTimer();
       // If needed add/remove the cleanup step on idle.  We want to expire on
       // idle only if history is dirty, to preserve mobile devices batteries.
       this.expireOnIdle = aNewStatus == STATUS.DIRTY;
     }
-    return aNewStatus;
   },
   get status() {
     return this._status;
   },
 
   _isIdleObserver: false,
   _expireOnIdle: false,
   set expireOnIdle(aExpireOnIdle) {
@@ -781,17 +780,16 @@ nsPlacesExpiration.prototype = {
     // If running a debug expiration we need full control of what happens
     // but idle cleanup could activate in the middle, since tinderboxes are
     // permanently idle.  That would cause unexpected oranges, so disable it.
     if (this._debugLimit !== undefined) {
       this._expireOnIdle = false;
     } else {
       this._expireOnIdle = aExpireOnIdle;
     }
-    return this._expireOnIdle;
   },
   get expireOnIdle() {
     return this._expireOnIdle;
   },
 
   async _loadPrefs() {
     // Get the user's limit, if it was set.
     this._urisLimit = this._prefBranch.getIntPref(