[gnome-shell] cleanup: Use new indentation style for arrays



commit ac9fbe92e53f00352209b084ad0a06d6ad543188
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Mar 27 14:18:34 2020 +0100

    cleanup: Use new indentation style for arrays
    
    We've made some progress on transitioning to the modern indentation
    style, and for arrays the legacy style is now rare enough to make
    a bulk transition feasible.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2200>

 js/gdm/loginDialog.js               |  6 ++++--
 js/perf/hwtest.js                   | 13 +++++++------
 js/ui/components/networkAgent.js    | 10 ++++++----
 js/ui/components/telepathyClient.js | 10 ++++++----
 js/ui/ibusCandidatePopup.js         | 14 +++++++++-----
 js/ui/magnifier.js                  | 20 +++++++++++++-------
 js/ui/messageList.js                | 24 ++++++++++++++++--------
 js/ui/notificationDaemon.js         | 11 ++++++-----
 js/ui/remoteSearch.js               |  6 ++++--
 js/ui/sessionMode.js                | 15 +++++++++------
 js/ui/shellMountOperation.js        | 18 ++++++++++++------
 js/ui/status/keyboard.js            | 12 ++++++++----
 js/ui/status/network.js             |  8 +++++---
 js/ui/windowManager.js              | 32 ++++++++++++++++++++------------
 lint/eslintrc-legacy.yml            |  1 -
 15 files changed, 125 insertions(+), 75 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 4e2c948dc9..f114e86eac 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -1192,8 +1192,10 @@ var LoginDialog = GObject.registerClass({
 
         this._updateCancelButton();
 
-        let batch = new Batch.ConcurrentBatch(this, [GdmUtil.cloneAndFadeOutActor(this._userSelectionBox),
-                                                     this._beginVerificationForItem(activatedItem)]);
+        const batch = new Batch.ConcurrentBatch(this, [
+            GdmUtil.cloneAndFadeOutActor(this._userSelectionBox),
+            this._beginVerificationForItem(activatedItem),
+        ]);
         batch.run();
     }
 
diff --git a/js/perf/hwtest.js b/js/perf/hwtest.js
index 0f396acd32..8793ce8a9d 100644
--- a/js/perf/hwtest.js
+++ b/js/perf/hwtest.js
@@ -73,12 +73,13 @@ function waitSignal(object, signal) {
 }
 
 function extractBootTimestamp() {
-    let sp = Gio.Subprocess.new(['journalctl', '-b',
-                                 'MESSAGE_ID=7d4958e842da4a758f6c1cdc7b36dcc5',
-                                 'UNIT=graphical.target',
-                                 '-o',
-                                 'json'],
-                                Gio.SubprocessFlags.STDOUT_PIPE);
+    const sp = Gio.Subprocess.new([
+        'journalctl', '-b',
+        'MESSAGE_ID=7d4958e842da4a758f6c1cdc7b36dcc5',
+        'UNIT=graphical.target',
+        '-o',
+        'json',
+    ], Gio.SubprocessFlags.STDOUT_PIPE);
     let result = null;
 
     let datastream = Gio.DataInputStream.new(sp.get_stdout_pipe());
diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js
index 1960ad1e73..82ed97890b 100644
--- a/js/ui/components/networkAgent.js
+++ b/js/ui/components/networkAgent.js
@@ -425,10 +425,12 @@ var VPNRequestHandler = class {
 
         let connectionSetting = connection.get_setting_connection();
 
-        let argv = [authHelper.fileName,
-                    '-u', connectionSetting.uuid,
-                    '-n', connectionSetting.id,
-                    '-s', serviceType];
+        const argv = [
+            authHelper.fileName,
+            '-u', connectionSetting.uuid,
+            '-n', connectionSetting.id,
+            '-s', serviceType,
+        ];
         if (authHelper.externalUIMode)
             argv.push('--external-ui-mode');
         if (flags & NM.SecretAgentGetSecretsFlags.ALLOW_INTERACTION)
diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js
index 335f32a9ad..e0719a465a 100644
--- a/js/ui/components/telepathyClient.js
+++ b/js/ui/components/telepathyClient.js
@@ -145,10 +145,12 @@ class TelepathyClient extends Tp.BaseClient {
         factory.add_account_features([Tp.Account.get_feature_quark_connection()]);
         factory.add_connection_features([Tp.Connection.get_feature_quark_contact_list()]);
         factory.add_channel_features([Tp.Channel.get_feature_quark_contacts()]);
-        factory.add_contact_features([Tp.ContactFeature.ALIAS,
-                                      Tp.ContactFeature.AVATAR_DATA,
-                                      Tp.ContactFeature.PRESENCE,
-                                      Tp.ContactFeature.SUBSCRIPTION_STATES]);
+        factory.add_contact_features([
+            Tp.ContactFeature.ALIAS,
+            Tp.ContactFeature.AVATAR_DATA,
+            Tp.ContactFeature.PRESENCE,
+            Tp.ContactFeature.SUBSCRIPTION_STATES,
+        ]);
 
         // Set up a SimpleObserver, which will call _observeChannels whenever a
         // channel matching its filters is detected.
diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js
index 5a9fe77928..68c14b8bbe 100644
--- a/js/ui/ibusCandidatePopup.js
+++ b/js/ui/ibusCandidatePopup.js
@@ -8,14 +8,18 @@ const Main = imports.ui.main;
 
 var MAX_CANDIDATES_PER_PAGE = 16;
 
-var DEFAULT_INDEX_LABELS = ['1', '2', '3', '4', '5', '6', '7', '8',
-                            '9', '0', 'a', 'b', 'c', 'd', 'e', 'f'];
+var DEFAULT_INDEX_LABELS = [
+    '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
+    'a', 'b', 'c', 'd', 'e', 'f',
+];
 
 var CandidateArea = GObject.registerClass({
     Signals: {
-        'candidate-clicked': { param_types: [GObject.TYPE_UINT,
-                                             GObject.TYPE_UINT,
-                                             Clutter.ModifierType.$gtype] },
+        'candidate-clicked': {
+            param_types: [
+                GObject.TYPE_UINT, GObject.TYPE_UINT, Clutter.ModifierType.$gtype,
+            ],
+        },
         'cursor-down': {},
         'cursor-up': {},
         'next-page': {},
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index e68dc84f0e..da4c53f8e6 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -802,8 +802,10 @@ var ZoomRegion = class ZoomRegion {
         }
 
         let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
-        let [xFocus, yFocus] = [(extents.x + (extents.width / 2)) * scaleFactor,
-                                (extents.y + (extents.height / 2)) * scaleFactor];
+        const [xFocus, yFocus] = [
+            (extents.x + (extents.width / 2)) * scaleFactor,
+            (extents.y + (extents.height / 2)) * scaleFactor,
+        ];
 
         if (this._xFocus !== xFocus || this._yFocus !== yFocus) {
             [this._xFocus, this._yFocus] = [xFocus, yFocus];
@@ -997,9 +999,11 @@ var ZoomRegion = class ZoomRegion {
         let roiWidth = this._viewPortWidth / this._xMagFactor;
         let roiHeight = this._viewPortHeight / this._yMagFactor;
 
-        return [this._xCenter - roiWidth / 2,
-                this._yCenter - roiHeight / 2,
-                roiWidth, roiHeight];
+        return [
+            this._xCenter - roiWidth / 2,
+            this._yCenter - roiHeight / 2,
+            roiWidth, roiHeight,
+        ];
     }
 
     /**
@@ -1580,8 +1584,10 @@ var ZoomRegion = class ZoomRegion {
     _screenToViewPort(screenX, screenY) {
         // Converts coordinates relative to the (unmagnified) screen to coordinates
         // relative to the origin of this._magView
-        return [this._viewPortWidth / 2 + (screenX - this._xCenter) * this._xMagFactor,
-                this._viewPortHeight / 2 + (screenY - this._yCenter) * this._yMagFactor];
+        return [
+            this._viewPortWidth / 2 + (screenX - this._xCenter) * this._xMagFactor,
+            this._viewPortHeight / 2 + (screenY - this._yCenter) * this._yMagFactor,
+        ];
     }
 
     _updateMagViewGeometry() {
diff --git a/js/ui/messageList.js b/js/ui/messageList.js
index 45ebbf53d0..a8431ac54e 100644
--- a/js/ui/messageList.js
+++ b/js/ui/messageList.js
@@ -192,16 +192,20 @@ class ScaleLayout extends Clutter.BinLayout {
         this._connectContainer(container);
 
         let [min, nat] = super.vfunc_get_preferred_width(container, forHeight);
-        return [Math.floor(min * container.scale_x),
-                Math.floor(nat * container.scale_x)];
+        return [
+            Math.floor(min * container.scale_x),
+            Math.floor(nat * container.scale_x),
+        ];
     }
 
     vfunc_get_preferred_height(container, forWidth) {
         this._connectContainer(container);
 
         let [min, nat] = super.vfunc_get_preferred_height(container, forWidth);
-        return [Math.floor(min * container.scale_y),
-                Math.floor(nat * container.scale_y)];
+        return [
+            Math.floor(min * container.scale_y),
+            Math.floor(nat * container.scale_y),
+        ];
     }
 });
 
@@ -275,10 +279,14 @@ var LabelExpanderLayout = GObject.registerClass({
 
         if (children[1]) {
             let [min2, nat2] = children[1].get_preferred_height(forWidth);
-            let [expMin, expNat] = [Math.min(min2, min * this._expandLines),
-                                    Math.min(nat2, nat * this._expandLines)];
-            [min, nat] = [min + this._expansion * (expMin - min),
-                          nat + this._expansion * (expNat - nat)];
+            const [expMin, expNat] = [
+                Math.min(min2, min * this._expandLines),
+                Math.min(nat2, nat * this._expandLines),
+            ];
+            [min, nat] = [
+                min + this._expansion * (expMin - min),
+                nat + this._expansion * (expNat - nat),
+            ];
         }
 
         return [min, nat];
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 4058ebdc39..bf886b1a69 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -43,8 +43,10 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
 
     _imageForNotificationData(hints) {
         if (hints['image-data']) {
-            let [width, height, rowStride, hasAlpha,
-                 bitsPerSample, nChannels_, data] = hints['image-data'];
+            const [
+                width, height, rowStride, hasAlpha,
+                bitsPerSample, nChannels_, data,
+            ] = hints['image-data'];
             return Shell.util_create_pixbuf_from_data(data, GdkPixbuf.Colorspace.RGB, hasAlpha,
                                                       bitsPerSample, width, height, rowStride);
         } else if (hints['image-path']) {
@@ -195,9 +197,8 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
     }
 
     _notifyForSource(source, ndata) {
-        let [id_, icon, summary, body, actions, hints, notification] =
-            [ndata.id, ndata.icon, ndata.summary, ndata.body,
-             ndata.actions, ndata.hints, ndata.notification];
+        const { icon, summary, body, actions, hints } = ndata;
+        let { notification } = ndata;
 
         if (notification == null) {
             notification = new MessageTray.Notification(source);
diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js
index 368afc5dae..a31a17ff52 100644
--- a/js/ui/remoteSearch.js
+++ b/js/ui/remoteSearch.js
@@ -221,8 +221,10 @@ var RemoteSearchProvider = class {
         } else if (meta['gicon']) {
             gicon = Gio.icon_new_for_string(meta['gicon']);
         } else if (meta['icon-data']) {
-            let [width, height, rowStride, hasAlpha,
-                 bitsPerSample, nChannels_, data] = meta['icon-data'];
+            const [
+                width, height, rowStride, hasAlpha,
+                bitsPerSample, nChannels_, data,
+            ] = meta['icon-data'];
             gicon = Shell.util_create_pixbuf_from_data(data, GdkPixbuf.Colorspace.RGB, hasAlpha,
                                                        bitsPerSample, width, height, rowStride);
         }
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
index 7d83ddb6be..b8b627370d 100644
--- a/js/ui/sessionMode.js
+++ b/js/ui/sessionMode.js
@@ -11,6 +11,14 @@ const Config = imports.misc.config;
 
 const DEFAULT_MODE = 'restrictive';
 
+const USER_SESSION_COMPONENTS = [
+    'polkitAgent', 'telepathyClient', 'keyring',
+    'autorunManager', 'automountManager',
+];
+
+if (Config.HAVE_NETWORKMANAGER)
+    USER_SESSION_COMPONENTS.push('networkAgent');
+
 const _modes = {
     'restrictive': {
         parentMode: null,
@@ -82,12 +90,7 @@ const _modes = {
         isLocked: false,
         isPrimary: true,
         unlockDialog: imports.ui.unlockDialog.UnlockDialog,
-        components: Config.HAVE_NETWORKMANAGER
-            ? ['networkAgent', 'polkitAgent', 'telepathyClient',
-               'keyring', 'autorunManager', 'automountManager']
-            : ['polkitAgent', 'telepathyClient',
-               'keyring', 'autorunManager', 'automountManager'],
-
+        components: USER_SESSION_COMPONENTS,
         panel: {
             left: ['activities', 'appMenu'],
             center: ['dateMenu'],
diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js
index 0ef383d582..6e213cd62a 100644
--- a/js/ui/shellMountOperation.js
+++ b/js/ui/shellMountOperation.js
@@ -254,12 +254,18 @@ var ShellMountQuestionDialog = GObject.registerClass({
 });
 
 var ShellMountPasswordDialog = GObject.registerClass({
-    Signals: { 'response': { param_types: [GObject.TYPE_INT,
-                                           GObject.TYPE_STRING,
-                                           GObject.TYPE_BOOLEAN,
-                                           GObject.TYPE_BOOLEAN,
-                                           GObject.TYPE_BOOLEAN,
-                                           GObject.TYPE_UINT] } },
+    Signals: {
+        'response': {
+            param_types: [
+                GObject.TYPE_INT,
+                GObject.TYPE_STRING,
+                GObject.TYPE_BOOLEAN,
+                GObject.TYPE_BOOLEAN,
+                GObject.TYPE_BOOLEAN,
+                GObject.TYPE_UINT,
+            ],
+        },
+    },
 }, class ShellMountPasswordDialog extends ModalDialog.ModalDialog {
     _init(message, flags) {
         let strings = message.split('\n');
diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index 0466395323..c2b5cfd6ee 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -795,16 +795,20 @@ class InputSourceIndicatorContainer extends St.Widget {
         // for those we don't actually display.
         return this.get_children().reduce((maxWidth, child) => {
             let width = child.get_preferred_width(forHeight);
-            return [Math.max(maxWidth[0], width[0]),
-                    Math.max(maxWidth[1], width[1])];
+            return [
+                Math.max(maxWidth[0], width[0]),
+                Math.max(maxWidth[1], width[1]),
+            ];
         }, [0, 0]);
     }
 
     vfunc_get_preferred_height(forWidth) {
         return this.get_children().reduce((maxHeight, child) => {
             let height = child.get_preferred_height(forWidth);
-            return [Math.max(maxHeight[0], height[0]),
-                    Math.max(maxHeight[1], height[1])];
+            return [
+                Math.max(maxHeight[0], height[0]),
+                Math.max(maxHeight[1], height[1]),
+            ];
         }, [0, 0]);
     }
 
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index a90b29778a..f06a8fe822 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1752,9 +1752,11 @@ class Indicator extends PanelMenu.SystemIndicator {
         this._nmDevices = [];
         this._devices = { };
 
-        let categories = [NMConnectionCategory.WIRED,
-                          NMConnectionCategory.WIRELESS,
-                          NMConnectionCategory.WWAN];
+        const categories = [
+            NMConnectionCategory.WIRED,
+            NMConnectionCategory.WIRELESS,
+            NMConnectionCategory.WWAN,
+        ];
         for (let category of categories) {
             this._devices[category] = new DeviceCategory(category);
             this.menu.addMenuItem(this._devices[category]);
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index a4bbf75ad5..0f56082303 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -1135,9 +1135,11 @@ var WindowManager = class {
     }
 
     _minimizeWindow(shellwm, actor) {
-        let types = [Meta.WindowType.NORMAL,
-                     Meta.WindowType.MODAL_DIALOG,
-                     Meta.WindowType.DIALOG];
+        const types = [
+            Meta.WindowType.NORMAL,
+            Meta.WindowType.MODAL_DIALOG,
+            Meta.WindowType.DIALOG,
+        ];
         if (!this._shouldAnimateActor(actor, types)) {
             shellwm.completed_minimize(actor);
             return;
@@ -1200,9 +1202,11 @@ var WindowManager = class {
     }
 
     _unminimizeWindow(shellwm, actor) {
-        let types = [Meta.WindowType.NORMAL,
-                     Meta.WindowType.MODAL_DIALOG,
-                     Meta.WindowType.DIALOG];
+        const types = [
+            Meta.WindowType.NORMAL,
+            Meta.WindowType.MODAL_DIALOG,
+            Meta.WindowType.DIALOG,
+        ];
         if (!this._shouldAnimateActor(actor, types)) {
             shellwm.completed_unminimize(actor);
             return;
@@ -1467,9 +1471,11 @@ var WindowManager = class {
         if (actor.meta_window.is_attached_dialog())
             this._checkDimming(actor.get_meta_window().get_transient_for());
 
-        let types = [Meta.WindowType.NORMAL,
-                     Meta.WindowType.DIALOG,
-                     Meta.WindowType.MODAL_DIALOG];
+        const types = [
+            Meta.WindowType.NORMAL,
+            Meta.WindowType.DIALOG,
+            Meta.WindowType.MODAL_DIALOG,
+        ];
         if (!this._shouldAnimateActor(actor, types)) {
             shellwm.completed_map(actor);
             return;
@@ -1544,9 +1550,11 @@ var WindowManager = class {
         if (window.is_attached_dialog())
             this._checkDimming(window.get_transient_for());
 
-        let types = [Meta.WindowType.NORMAL,
-                     Meta.WindowType.DIALOG,
-                     Meta.WindowType.MODAL_DIALOG];
+        const types = [
+            Meta.WindowType.NORMAL,
+            Meta.WindowType.DIALOG,
+            Meta.WindowType.MODAL_DIALOG,
+        ];
         if (!this._shouldAnimateActor(actor, types)) {
             shellwm.completed_destroy(actor);
             return;
diff --git a/lint/eslintrc-legacy.yml b/lint/eslintrc-legacy.yml
index e8a0e2935c..127166ef2c 100644
--- a/lint/eslintrc-legacy.yml
+++ b/lint/eslintrc-legacy.yml
@@ -7,7 +7,6 @@ rules:
       - 'CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > 
ClassExpression:first-child'
       CallExpression:
         arguments: first
-      ArrayExpression: first
       ObjectExpression: first
       MemberExpression: off
   jsdoc/check-alignment: off


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