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
This commit is contained in:
Julian 2023-10-05 14:50:36 +02:00
parent 88e510d54e
commit d903274d73
Signed by: julian
GPG Key ID: 094C2AC34192FA11
6 changed files with 22 additions and 15 deletions

View File

@ -49,5 +49,12 @@ rules:
object-curly-spacing: object-curly-spacing:
- error - error
- always - always
comma-dangle:
- error
- arrays: always-multiline
objects: always-multiline
imports: always-multiline
exports: always-multiline
functions: never
globals: globals:
log: readonly log: readonly

View File

@ -14,8 +14,8 @@ export default class BoxOrderManager extends GObject.Object {
static { static {
GObject.registerClass({ GObject.registerClass({
Signals: { Signals: {
"appIndicatorReady": {} "appIndicatorReady": {},
} },
}, this); }, this);
} }
@ -157,7 +157,7 @@ export default class BoxOrderManager extends GObject.Object {
const indicatorContainers = [ const indicatorContainers = [
Main.panel._leftBox.get_children(), Main.panel._leftBox.get_children(),
Main.panel._centerBox.get_children(), Main.panel._centerBox.get_children(),
Main.panel._rightBox.get_children() Main.panel._rightBox.get_children(),
].flat(); ].flat();
// Create an indicator containers set from the indicator containers for // 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(), center: Main.panel._centerBox.get_children(),
// Reverse this array, since the items in the left and center box // Reverse this array, since the items in the left and center box
// are logically LTR, while the items in the right box are RTL. // 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 // This function goes through the indicator containers of the given box

View File

@ -13,13 +13,13 @@ export default class PrefsBoxOrderItemRow extends Adw.ActionRow {
GTypeName: "PrefsBoxOrderItemRow", GTypeName: "PrefsBoxOrderItemRow",
Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-box-order-item-row.ui", GLib.UriFlags.NONE), Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-box-order-item-row.ui", GLib.UriFlags.NONE),
InternalChildren: [ InternalChildren: [
"item-name-display-label" "item-name-display-label",
], ],
Signals: { Signals: {
"move": { "move": {
param_types: [GObject.TYPE_STRING] param_types: [GObject.TYPE_STRING],
} },
} },
}, this); }, this);
this.install_action("row.forget", null, (self, _actionName, _param) => { this.install_action("row.forget", null, (self, _actionName, _param) => {
const parentListBox = self.get_parent(); const parentListBox = self.get_parent();

View File

@ -21,13 +21,13 @@ export default class PrefsBoxOrderListBox extends Gtk.ListBox {
"The box order this PrefsBoxOrderListBox is associated with.", "The box order this PrefsBoxOrderListBox is associated with.",
GObject.ParamFlags.READWRITE, GObject.ParamFlags.READWRITE,
"" ""
) ),
}, },
Signals: { Signals: {
"row-move": { "row-move": {
param_types: [PrefsBoxOrderItemRow, GObject.TYPE_STRING] param_types: [PrefsBoxOrderItemRow, GObject.TYPE_STRING],
} },
} },
}, this); }, this);
} }

View File

@ -8,7 +8,7 @@ export default class PrefsBoxOrderListEmptyPlaceholder extends Gtk.Box {
static { static {
GObject.registerClass({ GObject.registerClass({
GTypeName: "PrefsBoxOrderListEmptyPlaceholder", 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); }, this);
} }

View File

@ -19,8 +19,8 @@ export default class PrefsPage extends Adw.PreferencesPage {
InternalChildren: [ InternalChildren: [
"left-box-order-list-box", "left-box-order-list-box",
"center-box-order-list-box", "center-box-order-list-box",
"right-box-order-list-box" "right-box-order-list-box",
] ],
}, this); }, this);
} }