Bug 1316882: Turn on rest-spread-spacing eslint rule. draft
authorDave Townsend <dtownsend@oxymoronical.com>
Thu, 10 Nov 2016 15:12:47 -0800
changeset 438562 56745c78697c722269c84d4063d177d445ffc87f
parent 438561 1bcf8a619f3e3bce15513077960844232054cf83
child 438563 c47a9468de789ad036a0fbe945627c4abb9c53c6
push id35762
push userdtownsend@mozilla.com
push dateMon, 14 Nov 2016 19:31:49 +0000
bugs1316882
milestone52.0a1
Bug 1316882: Turn on rest-spread-spacing eslint rule. MozReview-Commit-ID: EbRmrGz1G0a
browser/components/customizableui/content/toolbar.xml
browser/components/migration/EdgeProfileMigrator.js
browser/components/migration/IEProfileMigrator.js
browser/modules/PluginContent.jsm
toolkit/.eslintrc.js
toolkit/content/widgets/richlistbox.xml
--- a/browser/components/customizableui/content/toolbar.xml
+++ b/browser/components/customizableui/content/toolbar.xml
@@ -562,17 +562,17 @@
           // evictNode might affect multiple windows.
           CustomizableUI.dispatchToolboxEvent("customizationchange", {}, window);
           CustomizableUI.dispatchToolboxEvent("aftercustomization", {}, window);
           return node;
         ]]></body>
       </method>
       <method name="getMigratedItems">
         <body><![CDATA[
-          return [... this._currentSetMigrated];
+          return [...this._currentSetMigrated];
         ]]></body>
       </method>
       <method name="_updateMigratedSet">
         <body><![CDATA[
           let newMigratedItems = this.getMigratedItems().join(',');
           if (this.getAttribute("migratedset") != newMigratedItems) {
             this.setAttribute("migratedset", newMigratedItems);
             this.ownerDocument.persist(this.id, "migratedset");
--- a/browser/components/migration/EdgeProfileMigrator.js
+++ b/browser/components/migration/EdgeProfileMigrator.js
@@ -429,27 +429,27 @@ EdgeProfileMigrator.prototype.getLastUse
   // sourceProfiles) or if we can't find the database file:
   if (this.sourceProfiles !== null || !gEdgeDatabase) {
     return Promise.resolve(new Date(0));
   }
   let logFilePath = OS.Path.join(gEdgeDatabase.parent.path, "LogFiles", "edb.log");
   let dbPath = gEdgeDatabase.path;
   let cookieMigrator = MSMigrationUtils.getCookiesMigrator(MSMigrationUtils.MIGRATION_TYPE_EDGE);
   let cookiePaths = cookieMigrator._cookiesFolders.map(f => f.path);
-  let datePromises = [logFilePath, dbPath, ... cookiePaths].map(path => {
+  let datePromises = [logFilePath, dbPath, ...cookiePaths].map(path => {
     return OS.File.stat(path).catch(() => null).then(info => {
       return info ? info.lastModificationDate : 0;
     });
   });
   datePromises.push(new Promise(resolve => {
     let typedURLs = new Map();
     try {
       typedURLs = MSMigrationUtils.getTypedURLs(kEdgeRegistryRoot);
     } catch (ex) {}
-    let times = [0, ... typedURLs.values()];
+    let times = [0, ...typedURLs.values()];
     resolve(Math.max.apply(Math, times));
   }));
   return Promise.all(datePromises).then(dates => {
     return new Date(Math.max.apply(Math, dates));
   });
 };
 
 /* Somewhat counterintuitively, this returns:
--- a/browser/components/migration/IEProfileMigrator.js
+++ b/browser/components/migration/IEProfileMigrator.js
@@ -495,17 +495,17 @@ IEProfileMigrator.prototype.getLastUsedD
       return info ? info.lastModificationDate : 0;
     });
   });
   datePromises.push(new Promise(resolve => {
     let typedURLs = new Map();
     try {
       typedURLs = MSMigrationUtils.getTypedURLs("Software\\Microsoft\\Internet Explorer");
     } catch (ex) {}
-    let dates = [0, ... typedURLs.values()];
+    let dates = [0, ...typedURLs.values()];
     resolve(Math.max.apply(Math, dates));
   }));
   return Promise.all(datePromises).then(dates => {
     return new Date(Math.max.apply(Math, dates));
   });
 };
 
 Object.defineProperty(IEProfileMigrator.prototype, "sourceHomePageURL", {
--- a/browser/modules/PluginContent.jsm
+++ b/browser/modules/PluginContent.jsm
@@ -134,17 +134,17 @@ PluginContent.prototype = {
         let data = JSON.parse(aData);
         if (this.haveShownNotification &&
             aSubject.top.document == this.content.document &&
             data.formats.toLowerCase().includes("application/x-mpegurl", 0)) {
           let principal = this.content.document.nodePrincipal;
           let location = this.content.document.location.href;
           this.global.content.pluginRequiresReload = true;
           this.global.sendAsyncMessage("PluginContent:ShowClickToPlayNotification",
-                                       { plugins: [... this.pluginData.values()],
+                                       { plugins: [...this.pluginData.values()],
                                          showNow: true,
                                          location: location,
                                        }, null, principal);
         }
     }
   },
 
   onPageShow: function (event) {
@@ -860,17 +860,17 @@ PluginContent.prototype = {
       }
 
       this.pluginData.set(pluginInfo.permissionString, pluginInfo);
     }
 
     this.haveShownNotification = true;
 
     this.global.sendAsyncMessage("PluginContent:ShowClickToPlayNotification", {
-      plugins: [... this.pluginData.values()],
+      plugins: [...this.pluginData.values()],
       showNow: showNow,
       location: location,
     }, null, principal);
   },
 
   /**
    * Updates the "hidden plugin" notification bar UI.
    *
@@ -943,17 +943,17 @@ PluginContent.prototype = {
         }
       }
     }
 
     // If there are any items remaining in `actions` now, they are hidden
     // plugins that need a notification bar.
     this.global.sendAsyncMessage("PluginContent:UpdateHiddenPluginUI", {
       haveInsecure: haveInsecure,
-      actions: [... actions.values()],
+      actions: [...actions.values()],
       location: location,
     }, null, principal);
   },
 
   removeNotification: function (name) {
     this.global.sendAsyncMessage("PluginContent:RemoveNotification", { name: name });
   },
 
--- a/toolkit/.eslintrc.js
+++ b/toolkit/.eslintrc.js
@@ -157,16 +157,19 @@ module.exports = {
     // "no-unused-vars": ["error", {"vars": "all", "args": "none"}],
 
     // No using variables before defined
     // "no-use-before-define": ["error", "nofunc"],
 
     // No using with
     "no-with": "error",
 
+    // No spacing inside rest or spread expressions
+    "rest-spread-spacing": "error",
+
     // Always require semicolon at end of statement
     // "semi": ["error", "always"],
 
     // Require space before blocks
     "space-before-blocks": "error",
 
     // Never use spaces before function parentheses
     // "space-before-function-paren": ["error", { "anonymous": "always", "named": "never" }],
--- a/toolkit/content/widgets/richlistbox.xml
+++ b/toolkit/content/widgets/richlistbox.xml
@@ -56,17 +56,17 @@
             // (otherwise we'll lose the selection when a template gets rebuilt)
             if (this._suppressOnSelect || this.suppressOnSelect)
               return;
 
             // remember the current item and all selected items with IDs
             var state = this.currentItem ? this.currentItem.id : "";
             if (this.selType == "multiple" && this.selectedCount) {
               let getId = function getId(aItem) { return aItem.id; }
-              state += " " + [... this.selectedItems].filter(getId).map(getId).join(" ");
+              state += " " + [...this.selectedItems].filter(getId).map(getId).join(" ");
             }
             if (state)
               this.setAttribute("last-selected", state);
             else
               this.removeAttribute("last-selected");
 
             // preserve the index just in case no IDs are available
             if (this.currentIndex > -1)