[gnome-shell] cleanup: Disambiguate assignments in arrow functions



commit b446667df65a5dcec88f702385ebc5f4d0e4a457
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Aug 19 22:20:35 2019 +0200

    cleanup: Disambiguate assignments in arrow functions
    
    As arrow functions have an implicit return value, an assignment of
    this.foo = bar could have been intended as a this.foo === bar
    comparison. To catch those errors, we will disallow these kinds
    of assignments unless they are marked explicitly by an extra pair
    of parentheses.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731

 js/misc/jsParse.js               | 2 +-
 js/perf/hwtest.js                | 4 ++--
 js/ui/accessDialog.js            | 2 +-
 js/ui/appDisplay.js              | 2 +-
 js/ui/audioDeviceSelection.js    | 2 +-
 js/ui/components/networkAgent.js | 2 +-
 js/ui/dateMenu.js                | 2 +-
 js/ui/modalDialog.js             | 2 +-
 js/ui/ripples.js                 | 2 +-
 js/ui/status/network.js          | 2 +-
 js/ui/status/system.js           | 2 +-
 js/ui/status/thunderbolt.js      | 2 +-
 js/ui/windowManager.js           | 2 +-
 js/ui/workspacesView.js          | 2 +-
 14 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/js/misc/jsParse.js b/js/misc/jsParse.js
index 43e99cabcf..8cfff1659a 100644
--- a/js/misc/jsParse.js
+++ b/js/misc/jsParse.js
@@ -172,7 +172,7 @@ function getPropertyNamesFromExpression(expr, commandHeader = '') {
 
         // Make sure propsUnique contains one key for every
         // property so we end up with a unique list of properties
-        allProps.map(p => propsUnique[p] = null);
+        allProps.map(p => (propsUnique[p] = null));
     }
     return Object.keys(propsUnique).sort();
 }
diff --git a/js/perf/hwtest.js b/js/perf/hwtest.js
index be7392984d..5b8934332d 100644
--- a/js/perf/hwtest.js
+++ b/js/perf/hwtest.js
@@ -57,7 +57,7 @@ function waitAndDraw(milliseconds) {
             cb();
     });
 
-    return callback => cb = callback;
+    return callback => (cb = callback);
 }
 
 function waitSignal(object, signal) {
@@ -69,7 +69,7 @@ function waitSignal(object, signal) {
             cb();
     });
 
-    return callback => cb = callback;
+    return callback => (cb = callback);
 }
 
 function extractBootTimestamp() {
diff --git a/js/ui/accessDialog.js b/js/ui/accessDialog.js
index 06321407bd..30389eda46 100644
--- a/js/ui/accessDialog.js
+++ b/js/ui/accessDialog.js
@@ -147,7 +147,7 @@ var AccessDialogDBus = class {
                                       subtitle, body, options);
         dialog.open();
 
-        dialog.connect('closed', () => this._accessDialog = null);
+        dialog.connect('closed', () => (this._accessDialog = null));
 
         this._accessDialog = dialog;
     }
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index b98781db08..d61329fd4d 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -505,7 +505,7 @@ var AllView = class AllView extends BaseAppView {
                 opacity: 0,
                 duration: VIEWS_SWITCH_TIME,
                 mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-                onComplete: () => this.opacity = 255
+                onComplete: () => (this.opacity = 255)
             });
 
         if (animationDirection == IconGrid.AnimationDirection.OUT)
diff --git a/js/ui/audioDeviceSelection.js b/js/ui/audioDeviceSelection.js
index 232307eea4..a5097216d8 100644
--- a/js/ui/audioDeviceSelection.js
+++ b/js/ui/audioDeviceSelection.js
@@ -161,7 +161,7 @@ var AudioDeviceSelectionDBus = class AudioDeviceSelectionDBus {
 
         let [deviceNames] = params;
         let devices = 0;
-        deviceNames.forEach(n => devices |= AudioDevice[n.toUpperCase()]);
+        deviceNames.forEach(n => (devices |= AudioDevice[n.toUpperCase()]));
 
         let dialog;
         try {
diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js
index f037ef783b..9e1063d2b3 100644
--- a/js/ui/components/networkAgent.js
+++ b/js/ui/components/networkAgent.js
@@ -624,7 +624,7 @@ var NetworkAgent = class {
         this._pluginDir = Gio.file_new_for_path(Config.VPNDIR);
         try {
             let monitor = this._pluginDir.monitor(Gio.FileMonitorFlags.NONE, null);
-            monitor.connect('changed', () => this._vpnCacheBuilt = false);
+            monitor.connect('changed', () => (this._vpnCacheBuilt = false));
         } catch (e) {
             log(`Failed to create monitor for VPN plugin dir: ${e.message}`);
         }
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index cfe52091f0..9a086de477 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -413,7 +413,7 @@ var MessagesIndicator = class MessagesIndicator {
 
     _updateCount() {
         let count = 0;
-        this._sources.forEach(source => count += source.unseenCount);
+        this._sources.forEach(source => (count += source.unseenCount));
         count -= Main.messageTray.queueCount;
 
         this.actor.visible = (count > 0);
diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js
index 1d2c694dc9..1eeb15a956 100644
--- a/js/ui/modalDialog.js
+++ b/js/ui/modalDialog.js
@@ -253,7 +253,7 @@ var ModalDialog = GObject.registerClass({
             opacity: 0,
             duration: FADE_OUT_DIALOG_TIME,
             mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-            onComplete: () => this.state = State.FADED_OUT
+            onComplete: () => (this.state = State.FADED_OUT)
         });
     }
 });
diff --git a/js/ui/ripples.js b/js/ui/ripples.js
index 99c1dfc533..458501d4af 100644
--- a/js/ui/ripples.js
+++ b/js/ui/ripples.js
@@ -67,7 +67,7 @@ var Ripples = class Ripples {
             delay,
             duration,
             mode: Clutter.AnimationMode.LINEAR,
-            onComplete: () => ripple.visible = false
+            onComplete: () => (ripple.visible = false)
         });
     }
 
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 5d939648f6..e7512122a7 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1676,7 +1676,7 @@ var NMApplet = class extends PanelMenu.SystemIndicator {
                                                   'network-transmit-receive');
             this._source.policy = new MessageTray.NotificationApplicationPolicy('gnome-network-panel');
 
-            this._source.connect('destroy', () => this._source = null);
+            this._source.connect('destroy', () => (this._source = null));
             Main.messageTray.add(this._source);
         }
     }
diff --git a/js/ui/status/system.js b/js/ui/status/system.js
index e353e8fbaa..8ca04481e0 100644
--- a/js/ui/status/system.js
+++ b/js/ui/status/system.js
@@ -33,7 +33,7 @@ var AltSwitcher = class {
 
         this.actor = new St.Bin();
         this.actor.connect('destroy', this._onDestroy.bind(this));
-        this.actor.connect('notify::mapped', () => this._flipped = false);
+        this.actor.connect('notify::mapped', () => (this._flipped = false));
     }
 
     _sync() {
diff --git a/js/ui/status/thunderbolt.js b/js/ui/status/thunderbolt.js
index e4de032a9f..23b437daf4 100644
--- a/js/ui/status/thunderbolt.js
+++ b/js/ui/status/thunderbolt.js
@@ -260,7 +260,7 @@ var Indicator = class extends PanelMenu.SystemIndicator {
         if (!this._source) {
             this._source = new MessageTray.Source(_("Thunderbolt"),
                                                   'thunderbolt-symbolic');
-            this._source.connect('destroy', () => this._source = null);
+            this._source.connect('destroy', () => (this._source = null));
 
             Main.messageTray.add(this._source);
         }
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 2972788491..11837c46a7 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -1114,7 +1114,7 @@ var WindowManager = class {
 
     _showPadOsd(display, device, settings, imagePath, editionMode, monitorIndex) {
         this._currentPadOsd = new PadOsd.PadOsd(device, settings, imagePath, editionMode, monitorIndex);
-        this._currentPadOsd.connect('closed', () => this._currentPadOsd = null);
+        this._currentPadOsd.connect('closed', () => (this._currentPadOsd = null));
 
         return this._currentPadOsd.actor;
     }
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 8c1ba81a6d..172d2d4905 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -247,7 +247,7 @@ var WorkspacesView = class extends WorkspacesViewBase {
         this.scrollAdjustment.ease(index, {
             mode: Clutter.AnimationMode.EASE_OUT_QUAD,
             duration: WORKSPACE_SWITCH_TIME,
-            onComplete: () => this._animatingScroll = false
+            onComplete: () => (this._animatingScroll = false)
         });
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]