[polari/wip/fmuellner/more-style-changes: 3/3] style: Change indentation style of object arrays



commit f29164d13dba6f92867ac495f45b3d0aa5f6153d
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Jul 29 00:37:25 2018 +0200

    style: Change indentation style of object arrays
    
    It took me a bit to find a style that complies with gjs' indentation
    rules and still looks good to me, but here we are.
    
    https://gitlab.gnome.org/GNOME/polari/merge_requests/95

 lint/eslintrc-legacy.json |   1 -
 src/application.js        | 135 +++++++++++++++++++++++++++-------------------
 src/chatView.js           | 131 ++++++++++++++++++++++++--------------------
 src/roomList.js           |  60 +++++++++++----------
 src/roomManager.js        |  20 +++----
 src/telepathyClient.js    |  43 ++++++++-------
 src/userList.js           |  38 +++++++------
 src/userTracker.js        |  38 +++++++------
 8 files changed, 265 insertions(+), 201 deletions(-)
---
diff --git a/lint/eslintrc-legacy.json b/lint/eslintrc-legacy.json
index 7f5a479..aca79ad 100644
--- a/lint/eslintrc-legacy.json
+++ b/lint/eslintrc-legacy.json
@@ -9,7 +9,6 @@
                     "CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > 
ClassExpression:first-child"
                 ],
                 "CallExpression": { "arguments": "first" },
-                "ObjectExpression": "first",
                 "MemberExpression": "off"
             }
         ]
diff --git a/src/application.js b/src/application.js
index ba1c8db..04a2499 100644
--- a/src/application.js
+++ b/src/application.js
@@ -178,77 +178,100 @@ var Application = GObject.registerClass({
     vfunc_startup() {
         super.vfunc_startup();
 
-        /* eslint-disable indent */
-        let actionEntries = [
-          { name: 'show-join-dialog',
+        let actionEntries = [{
+            name: 'show-join-dialog',
             activate: this._onShowJoinDialog.bind(this),
-            accels: ['<Primary>n'] },
-          { name: 'join-room',
+            accels: ['<Primary>n']
+        }, {
+            name: 'join-room',
             activate: this._onJoinRoom.bind(this),
-            parameter_type: GLib.VariantType.new('(ssu)') },
-          { name: 'message-user',
+            parameter_type: GLib.VariantType.new('(ssu)')
+        }, {
+            name: 'message-user',
             activate: this._onMessageUser.bind(this),
-            parameter_type: GLib.VariantType.new('(sssu)') },
-          { name: 'leave-room',
-            parameter_type: GLib.VariantType.new('(ss)') },
-          { name: 'leave-current-room',
+            parameter_type: GLib.VariantType.new('(sssu)')
+        }, {
+            name: 'leave-room',
+            parameter_type: GLib.VariantType.new('(ss)')
+        }, {
+            name: 'leave-current-room',
             activate: this._onLeaveCurrentRoom.bind(this),
             create_hook: (a) => a.enabled = false,
-            accels: ['<Primary>w'] },
-          { name: 'authenticate-account',
-            parameter_type: GLib.VariantType.new('(os)') },
-          { name: 'connect-account',
+            accels: ['<Primary>w']
+        }, {
+            name: 'authenticate-account',
+            parameter_type: GLib.VariantType.new('(os)')
+        }, {
+            name: 'connect-account',
             activate: this._onConnectAccount.bind(this),
-            parameter_type: GLib.VariantType.new('o') },
-          { name: 'disconnect-account',
+            parameter_type: GLib.VariantType.new('o')
+        }, {
+            name: 'disconnect-account',
             activate: this._onConnectAccount.bind(this),
-            parameter_type: GLib.VariantType.new('o') },
-          { name: 'reconnect-account',
+            parameter_type: GLib.VariantType.new('o')
+        }, {
+            name: 'reconnect-account',
             activate: this._onConnectAccount.bind(this),
-            parameter_type: GLib.VariantType.new('o') },
-          { name: 'user-list',
+            parameter_type: GLib.VariantType.new('o')
+        }, {
+            name: 'user-list',
             activate: this._onToggleAction.bind(this),
             create_hook: this._userListCreateHook.bind(this),
             state: GLib.Variant.new('b', false),
-            accels: ['F9', '<Primary>u'] },
-          { name: 'remove-connection',
+            accels: ['F9', '<Primary>u']
+        }, {
+            name: 'remove-connection',
             activate: this._onRemoveConnection.bind(this),
-            parameter_type: GLib.VariantType.new('o') },
-          { name: 'edit-connection',
+            parameter_type: GLib.VariantType.new('o')
+        }, {
+            name: 'edit-connection',
             activate: this._onEditConnection.bind(this),
-            parameter_type: GLib.VariantType.new('o') },
-          { name: 'save-identify-password',
-            parameter_type: GLib.VariantType.new('o') },
-          { name: 'discard-identify-password',
-            parameter_type: GLib.VariantType.new('o') },
-          { name: 'show-emoji-picker',
-            accels: ['<Primary>e'] },
-          { name: 'start-client',
-            activate: this._onStartClient.bind(this) },
-          { name: 'help',
+            parameter_type: GLib.VariantType.new('o')
+        }, {
+            name: 'save-identify-password',
+            parameter_type: GLib.VariantType.new('o')
+        }, {
+            name: 'discard-identify-password',
+            parameter_type: GLib.VariantType.new('o')
+        }, {
+            name: 'show-emoji-picker',
+            accels: ['<Primary>e']
+        }, {
+            name: 'start-client',
+            activate: this._onStartClient.bind(this)
+        }, {
+            name: 'help',
             activate: this._onShowHelp.bind(this),
-            accels: ['F1'] },
-          { name: 'about',
-            activate: this._onShowAbout.bind(this) },
-          { name: 'quit',
+            accels: ['F1']
+        }, {
+            name: 'about',
+            activate: this._onShowAbout.bind(this)
+        }, {
+            name: 'quit',
             activate: this._onQuit.bind(this),
-            accels: ['<Primary>q'] },
-          { name: 'next-room',
-            accels: ['<Primary>Page_Down', '<Alt>Down'] },
-          { name: 'previous-room',
-            accels: ['<Primary>Page_Up', '<Alt>Up'] },
-          { name: 'first-room',
-            accels: ['<Primary>Home'] },
-          { name: 'last-room',
-            accels: ['<Primary>End'] },
-          { name: 'nth-room',
-            parameter_type: GLib.VariantType.new('i') },
-          { name: 'next-pending-room',
-            accels: ['<Alt><Shift>Down', '<Primary><Shift>Page_Down'] },
-          { name: 'previous-pending-room',
-            accels: ['<Alt><Shift>Up', '<Primary><Shift>Page_Up'] }
-        ];
-        /* eslint-enable indent */
+            accels: ['<Primary>q']
+        }, {
+            name: 'next-room',
+            accels: ['<Primary>Page_Down', '<Alt>Down']
+        }, {
+            name: 'previous-room',
+            accels: ['<Primary>Page_Up', '<Alt>Up']
+        }, {
+            name: 'first-room',
+            accels: ['<Primary>Home']
+        }, {
+            name: 'last-room',
+            accels: ['<Primary>End']
+        }, {
+            name: 'nth-room',
+            parameter_type: GLib.VariantType.new('i')
+        }, {
+            name: 'next-pending-room',
+            accels: ['<Alt><Shift>Down', '<Primary><Shift>Page_Down']
+        }, {
+            name: 'previous-pending-room',
+            accels: ['<Alt><Shift>Up', '<Primary><Shift>Page_Up']
+        }];
         actionEntries.forEach(actionEntry => {
             let props = {};
             ['name', 'state', 'parameter_type'].forEach(prop => {
diff --git a/src/chatView.js b/src/chatView.js
index 456c1cf..f99ae3b 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -382,22 +382,28 @@ var ChatView = GObject.registerClass({
         this._channelSignals = [];
         this._channel = null;
 
-        let roomSignals = [
-            { name: 'notify::channel',
-              handler: this._onChannelChanged.bind(this) },
-            { name: 'member-renamed',
-              handler: this._onMemberRenamed.bind(this) },
-            { name: 'member-disconnected',
-              handler: this._onMemberDisconnected.bind(this) },
-            { name: 'member-kicked',
-              handler: this._onMemberKicked.bind(this) },
-            { name: 'member-banned',
-              handler: this._onMemberBanned.bind(this) },
-            { name: 'member-joined',
-              handler: this._onMemberJoined.bind(this) },
-            { name: 'member-left',
-              handler: this._onMemberLeft.bind(this) }
-        ];
+        let roomSignals = [{
+            name: 'notify::channel',
+            handler: this._onChannelChanged.bind(this)
+        }, {
+            name: 'member-renamed',
+            handler: this._onMemberRenamed.bind(this)
+        }, {
+            name: 'member-disconnected',
+            handler: this._onMemberDisconnected.bind(this)
+        }, {
+            name: 'member-kicked',
+            handler: this._onMemberKicked.bind(this)
+        }, {
+            name: 'member-banned',
+            handler: this._onMemberBanned.bind(this)
+        }, {
+            name: 'member-joined',
+            handler: this._onMemberJoined.bind(this)
+        }, {
+            name: 'member-left',
+            handler: this._onMemberLeft.bind(this)
+        }];
         this._roomSignals = [];
         roomSignals.forEach(signal => {
             this._roomSignals.push(room.connect(signal.name, signal.handler));
@@ -412,37 +418,44 @@ var ChatView = GObject.registerClass({
     _createTags() {
         let buffer = this._view.get_buffer();
         let tagTable = buffer.get_tag_table();
-        let tags = [
-            /* eslint-disable indent */
-          { name: 'nick',
+        let tags = [{
+            name: 'nick',
             left_margin: MARGIN,
-            weight: Pango.Weight.BOLD },
-          { name: 'gap',
-            pixels_above_lines: 10 },
-          { name: 'message',
-            indent: 0 },
-          { name: 'highlight',
-            weight: Pango.Weight.BOLD },
-          { name: 'status',
+            weight: Pango.Weight.BOLD
+        }, {
+            name: 'gap',
+            pixels_above_lines: 10
+        }, {
+            name: 'message',
+            indent: 0
+        }, {
+            name: 'highlight',
+            weight: Pango.Weight.BOLD
+        }, {
+            name: 'status',
             left_margin: MARGIN,
             indent: 0,
-            justification: Gtk.Justification.RIGHT },
-          { name: 'timestamp',
+            justification: Gtk.Justification.RIGHT
+        }, {
+            name: 'timestamp',
             left_margin: MARGIN,
             indent: 0,
-            justification: Gtk.Justification.RIGHT },
-          { name: 'action',
+            justification: Gtk.Justification.RIGHT
+        }, {
+            name: 'action',
             left_margin: MARGIN,
-            style: Pango.Style.ITALIC },
-          { name: 'url',
-            underline: Pango.Underline.SINGLE },
-          { name: 'indicator-line',
-            pixels_above_lines: 24 },
-          { name: 'loading',
+            style: Pango.Style.ITALIC
+        }, {
+            name: 'url',
+            underline: Pango.Underline.SINGLE
+        }, {
+            name: 'indicator-line',
+            pixels_above_lines: 24
+        }, {
+            name: 'loading',
             left_margin: MARGIN,
-            justification: Gtk.Justification.CENTER }
-            /* eslint-enable indent */
-        ];
+            justification: Gtk.Justification.CENTER
+        }];
         tags.forEach(tagProps => tagTable.add(new Gtk.TextTag(tagProps)));
     }
 
@@ -483,16 +496,16 @@ var ChatView = GObject.registerClass({
 
         let buffer = this._view.get_buffer();
         let tagTable = buffer.get_tag_table();
-        let tags = [
-            /* eslint-disable indent */
-          { name: 'status',
-            foreground_rgba: dimColor },
-          { name: 'timestamp',
-            foreground_rgba: dimColor },
-          { name: 'url',
-            foreground_rgba: linkColor }
-            /* eslint-enable indent */
-        ];
+        let tags = [{
+            name: 'status',
+            foreground_rgba: dimColor
+        }, {
+            name: 'timestamp',
+            foreground_rgba: dimColor
+        }, {
+            name: 'url',
+            foreground_rgba: linkColor
+        }];
         tags.forEach(tagProps => {
             let tag = tagTable.lookup(tagProps.name);
             for (let prop in tagProps) {
@@ -936,14 +949,16 @@ var ChatView = GObject.registerClass({
 
         this._joinTime = GLib.DateTime.new_now_utc().to_unix();
 
-        let channelSignals = [
-            { name: 'message-received',
-              handler: this._onMessageReceived.bind(this) },
-            { name: 'message-sent',
-              handler: this._onMessageSent.bind(this) },
-            { name: 'pending-message-removed',
-              handler: this._pendingMessageRemoved.bind(this) }
-        ];
+        let channelSignals = [{
+            name: 'message-received',
+            handler: this._onMessageReceived.bind(this)
+        }, {
+            name: 'message-sent',
+            handler: this._onMessageSent.bind(this)
+        }, {
+            name: 'pending-message-removed',
+            handler: this._pendingMessageRemoved.bind(this)
+        }];
         channelSignals.forEach(signal => {
             this._channelSignals.push(this._channel.connect(signal.name, signal.handler));
         });
diff --git a/src/roomList.js b/src/roomList.js
index 4592775..03492ed 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -470,33 +470,39 @@ class RoomList extends Gtk.ListBox {
         this._roomManager.rooms.forEach(r => this._roomAdded(this._roomManager, r));
 
         let app = Gio.Application.get_default();
-        let actions = [
-            { name: 'next-room',
-              handler: () => this._moveSelection(Gtk.DirectionType.DOWN) },
-            { name: 'previous-room',
-              handler: () => this._moveSelection(Gtk.DirectionType.UP) },
-            { name: 'first-room',
-              handler: () => this._selectRoomAtIndex(0) },
-            { name: 'last-room',
-              handler: () => {
-                  let nRows = this._roomManager.roomCount;
-                  this._selectRoomAtIndex(nRows - 1);
-              } },
-            { name: 'nth-room',
-              handler: (a, param) => {
-                  this._selectRoomAtIndex(param.get_int32() - 1);
-              } },
-            { name: 'next-pending-room',
-              handler: () => {
-                  this._moveSelectionFull(Gtk.DirectionType.DOWN,
-                                          row => row.hasPending);
-              } },
-            { name: 'previous-pending-room',
-              handler: () => {
-                  this._moveSelectionFull(Gtk.DirectionType.UP,
-                                          row => row.hasPending);
-              } }
-        ];
+        let actions = [{
+            name: 'next-room',
+            handler: () => this._moveSelection(Gtk.DirectionType.DOWN)
+        }, {
+            name: 'previous-room',
+            handler: () => this._moveSelection(Gtk.DirectionType.UP)
+        }, {
+            name: 'first-room',
+            handler: () => this._selectRoomAtIndex(0)
+        }, {
+            name: 'last-room',
+            handler: () => {
+                let nRows = this._roomManager.roomCount;
+                this._selectRoomAtIndex(nRows - 1);
+            }
+        }, {
+            name: 'nth-room',
+            handler: (a, param) => {
+                this._selectRoomAtIndex(param.get_int32() - 1);
+            }
+        }, {
+            name: 'next-pending-room',
+            handler: () => {
+                this._moveSelectionFull(Gtk.DirectionType.DOWN,
+                                        row => row.hasPending);
+            }
+        }, {
+            name: 'previous-pending-room',
+            handler: () => {
+                this._moveSelectionFull(Gtk.DirectionType.UP,
+                                        row => row.hasPending);
+            }
+        }];
         actions.forEach(a => {
             app.lookup_action(a.name).connect('activate', a.handler);
         });
diff --git a/src/roomManager.js b/src/roomManager.js
index 964c08c..f984679 100644
--- a/src/roomManager.js
+++ b/src/roomManager.js
@@ -19,15 +19,17 @@ var RoomManager = class {
         this._accountsMonitor = AccountsMonitor.getDefault();
 
         this._app = Gio.Application.get_default();
-        let actions = [
-            { name: 'join-room',
-              handler: this._onJoinActivated.bind(this) },
-            { name: 'message-user',
-              handler: this._onQueryActivated.bind(this) },
-            { name: 'leave-room',
-              after: true,
-              handler: this._onLeaveActivated.bind(this) }
-        ];
+        let actions = [{
+            name: 'join-room',
+            handler: this._onJoinActivated.bind(this)
+        }, {
+            name: 'message-user',
+            handler: this._onQueryActivated.bind(this)
+        }, {
+            name: 'leave-room',
+            after: true,
+            handler: this._onLeaveActivated.bind(this)
+        }];
         actions.forEach(a => {
             if (a.after)
                 this._app.lookup_action(a.name).connect_after('activate', a.handler);
diff --git a/src/telepathyClient.js b/src/telepathyClient.js
index a70032a..35f9972 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -134,24 +134,31 @@ class TelepathyClient extends Tp.BaseClient {
     }
 
     _onPrepared() {
-        let actions = [
-            { name: 'message-user',
-              handler: this._onQueryActivated.bind(this) },
-            { name: 'leave-room',
-              handler: this._onLeaveActivated.bind(this) },
-            { name: 'connect-account',
-              handler: this._onConnectAccountActivated.bind(this) },
-            { name: 'disconnect-account',
-              handler: this._onDisconnectAccountActivated.bind(this) },
-            { name: 'reconnect-account',
-              handler: this._onReconnectAccountActivated.bind(this) },
-            { name: 'authenticate-account',
-              handler: this._onAuthenticateAccountActivated.bind(this) },
-            { name: 'save-identify-password',
-              handler: this._onSaveIdentifyPasswordActivated.bind(this) },
-            { name: 'discard-identify-password',
-              handler: this._onDiscardIdentifyPasswordActivated.bind(this) }
-        ];
+        let actions = [{
+            name: 'message-user',
+            handler: this._onQueryActivated.bind(this)
+        }, {
+            name: 'leave-room',
+            handler: this._onLeaveActivated.bind(this)
+        }, {
+            name: 'connect-account',
+            handler: this._onConnectAccountActivated.bind(this)
+        }, {
+            name: 'disconnect-account',
+            handler: this._onDisconnectAccountActivated.bind(this)
+        }, {
+            name: 'reconnect-account',
+            handler: this._onReconnectAccountActivated.bind(this)
+        }, {
+            name: 'authenticate-account',
+            handler: this._onAuthenticateAccountActivated.bind(this)
+        }, {
+            name: 'save-identify-password',
+            handler: this._onSaveIdentifyPasswordActivated.bind(this)
+        }, {
+            name: 'discard-identify-password',
+            handler: this._onDiscardIdentifyPasswordActivated.bind(this)
+        }];
         actions.forEach(a => {
             this._app.lookup_action(a.name).connect('activate', a.handler);
         });
diff --git a/src/userList.js b/src/userList.js
index bbd8784..ac0bcde 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -603,22 +603,28 @@ class UserList extends Gtk.ScrolledWindow {
         this._rows = new Map();
         this._activeRow = null;
 
-        let roomSignals = [
-            { name: 'member-renamed',
-              handler: this._onMemberRenamed.bind(this) },
-            { name: 'member-disconnected',
-              handler: this._onMemberRemoved.bind(this) },
-            { name: 'member-kicked',
-              handler: this._onMemberRemoved.bind(this) },
-            { name: 'member-banned',
-              handler: this._onMemberRemoved.bind(this) },
-            { name: 'member-left',
-              handler: this._onMemberRemoved.bind(this) },
-            { name: 'member-joined',
-              handler: this._onMemberJoined.bind(this) },
-            { name: 'notify::channel',
-              handler: this._onChannelChanged.bind(this) }
-        ];
+        let roomSignals = [{
+            name: 'member-renamed',
+            handler: this._onMemberRenamed.bind(this)
+        }, {
+            name: 'member-disconnected',
+            handler: this._onMemberRemoved.bind(this)
+        }, {
+            name: 'member-kicked',
+            handler: this._onMemberRemoved.bind(this)
+        }, {
+            name: 'member-banned',
+            handler: this._onMemberRemoved.bind(this)
+        }, {
+            name: 'member-left',
+            handler: this._onMemberRemoved.bind(this)
+        }, {
+            name: 'member-joined',
+            handler: this._onMemberJoined.bind(this)
+        }, {
+            name: 'notify::channel',
+            handler: this._onChannelChanged.bind(this)
+        }];
         this._roomSignals = [];
         roomSignals.forEach(signal => {
             this._roomSignals.push(room.connect(signal.name, signal.handler));
diff --git a/src/userTracker.js b/src/userTracker.js
index 73eeba2..95067fc 100644
--- a/src/userTracker.js
+++ b/src/userTracker.js
@@ -96,22 +96,28 @@ const UserTracker = GObject.registerClass({
 
         this._ensureRoomMappingForRoom(room);
 
-        let roomSignals = [
-            { name: 'notify::channel',
-              handler: this._onChannelChanged.bind(this) },
-            { name: 'member-renamed',
-              handler: this._onMemberRenamed.bind(this) },
-            { name: 'member-disconnected',
-              handler: this._onMemberLeft.bind(this) },
-            { name: 'member-kicked',
-              handler: this._onMemberLeft.bind(this) },
-            { name: 'member-banned',
-              handler: this._onMemberLeft.bind(this) },
-            { name: 'member-joined',
-              handler: this._onMemberJoined.bind(this) },
-            { name: 'member-left',
-              handler: this._onMemberLeft.bind(this) }
-        ];
+        let roomSignals = [{
+            name: 'notify::channel',
+            handler: this._onChannelChanged.bind(this)
+        }, {
+            name: 'member-renamed',
+            handler: this._onMemberRenamed.bind(this)
+        }, {
+            name: 'member-disconnected',
+            handler: this._onMemberLeft.bind(this)
+        }, {
+            name: 'member-kicked',
+            handler: this._onMemberLeft.bind(this)
+        }, {
+            name: 'member-banned',
+            handler: this._onMemberLeft.bind(this)
+        }, {
+            name: 'member-joined',
+            handler: this._onMemberJoined.bind(this)
+        }, {
+            name: 'member-left',
+            handler: this._onMemberLeft.bind(this)
+        }];
 
         let signalIds = this._getRoomSignals(room);
         roomSignals.forEach(signal => {


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