From d903274d735f94f5374fb5ee5840e20f6bb9bf33 Mon Sep 17 00:00:00 2001 From: Julian Schacher Date: Thu, 5 Oct 2023 14:50:36 +0200 Subject: [PATCH] Other: Require trailing commas for multiline for most Require trailing commas for multiline for arrays, objects, imports and exports and disallow trailing commas for functions. Do this by updating the ESLint config and fixing new complaints. The reason for this change are the resulting future cleaner version diffs. Also see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Trailing_commas https://eslint.org/docs/latest/rules/comma-dangle --- .eslintrc.yml | 7 +++++++ src/extensionModules/BoxOrderManager.js | 8 ++++---- src/prefsModules/PrefsBoxOrderItemRow.js | 8 ++++---- src/prefsModules/PrefsBoxOrderListBox.js | 8 ++++---- src/prefsModules/PrefsBoxOrderListEmptyPlaceholder.js | 2 +- src/prefsModules/PrefsPage.js | 4 ++-- 6 files changed, 22 insertions(+), 15 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index f364ffc..caf7992 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -49,5 +49,12 @@ rules: object-curly-spacing: - error - always + comma-dangle: + - error + - arrays: always-multiline + objects: always-multiline + imports: always-multiline + exports: always-multiline + functions: never globals: log: readonly diff --git a/src/extensionModules/BoxOrderManager.js b/src/extensionModules/BoxOrderManager.js index 0525d08..c6f371d 100644 --- a/src/extensionModules/BoxOrderManager.js +++ b/src/extensionModules/BoxOrderManager.js @@ -14,8 +14,8 @@ export default class BoxOrderManager extends GObject.Object { static { GObject.registerClass({ Signals: { - "appIndicatorReady": {} - } + "appIndicatorReady": {}, + }, }, this); } @@ -157,7 +157,7 @@ export default class BoxOrderManager extends GObject.Object { const indicatorContainers = [ Main.panel._leftBox.get_children(), Main.panel._centerBox.get_children(), - Main.panel._rightBox.get_children() + Main.panel._rightBox.get_children(), ].flat(); // Create an indicator containers set from the indicator containers for @@ -212,7 +212,7 @@ export default class BoxOrderManager extends GObject.Object { center: Main.panel._centerBox.get_children(), // Reverse this array, since the items in the left and center box // are logically LTR, while the items in the right box are RTL. - right: Main.panel._rightBox.get_children().reverse() + right: Main.panel._rightBox.get_children().reverse(), }; // This function goes through the indicator containers of the given box diff --git a/src/prefsModules/PrefsBoxOrderItemRow.js b/src/prefsModules/PrefsBoxOrderItemRow.js index 9f350c1..3e09cd5 100644 --- a/src/prefsModules/PrefsBoxOrderItemRow.js +++ b/src/prefsModules/PrefsBoxOrderItemRow.js @@ -13,13 +13,13 @@ export default class PrefsBoxOrderItemRow extends Adw.ActionRow { GTypeName: "PrefsBoxOrderItemRow", Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-box-order-item-row.ui", GLib.UriFlags.NONE), InternalChildren: [ - "item-name-display-label" + "item-name-display-label", ], Signals: { "move": { - param_types: [GObject.TYPE_STRING] - } - } + param_types: [GObject.TYPE_STRING], + }, + }, }, this); this.install_action("row.forget", null, (self, _actionName, _param) => { const parentListBox = self.get_parent(); diff --git a/src/prefsModules/PrefsBoxOrderListBox.js b/src/prefsModules/PrefsBoxOrderListBox.js index 444745e..59d4417 100644 --- a/src/prefsModules/PrefsBoxOrderListBox.js +++ b/src/prefsModules/PrefsBoxOrderListBox.js @@ -21,13 +21,13 @@ export default class PrefsBoxOrderListBox extends Gtk.ListBox { "The box order this PrefsBoxOrderListBox is associated with.", GObject.ParamFlags.READWRITE, "" - ) + ), }, Signals: { "row-move": { - param_types: [PrefsBoxOrderItemRow, GObject.TYPE_STRING] - } - } + param_types: [PrefsBoxOrderItemRow, GObject.TYPE_STRING], + }, + }, }, this); } diff --git a/src/prefsModules/PrefsBoxOrderListEmptyPlaceholder.js b/src/prefsModules/PrefsBoxOrderListEmptyPlaceholder.js index 8dd772b..0fa0db3 100644 --- a/src/prefsModules/PrefsBoxOrderListEmptyPlaceholder.js +++ b/src/prefsModules/PrefsBoxOrderListEmptyPlaceholder.js @@ -8,7 +8,7 @@ export default class PrefsBoxOrderListEmptyPlaceholder extends Gtk.Box { static { GObject.registerClass({ GTypeName: "PrefsBoxOrderListEmptyPlaceholder", - Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-box-order-list-empty-placeholder.ui", GLib.UriFlags.NONE) + Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-box-order-list-empty-placeholder.ui", GLib.UriFlags.NONE), }, this); } diff --git a/src/prefsModules/PrefsPage.js b/src/prefsModules/PrefsPage.js index e871197..397a253 100644 --- a/src/prefsModules/PrefsPage.js +++ b/src/prefsModules/PrefsPage.js @@ -19,8 +19,8 @@ export default class PrefsPage extends Adw.PreferencesPage { InternalChildren: [ "left-box-order-list-box", "center-box-order-list-box", - "right-box-order-list-box" - ] + "right-box-order-list-box", + ], }, this); }