style: Avoid trailing commas in array destructuring

When destructuring multiple return values, we often use trailing commas
to indicate that there are additional elements that we are ignoring.

There isn't anything inherently wrong with that, but it's a style that's
too confusing for eslint - on the one hand we require a space after a
comma, on the other hand we require no space before closing brackets.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
This commit is contained in:
Florian Müllner 2019-01-29 20:20:09 +01:00
parent f250643385
commit 55235c2552
5 changed files with 9 additions and 9 deletions

View File

@ -321,8 +321,8 @@ class DashActor extends St.Widget {
let themeNode = this.get_theme_node();
let adjustedForWidth = themeNode.adjust_for_width(forWidth);
let [, showAppsButton] = this.get_children();
let [minHeight, ] = showAppsButton.get_preferred_height(adjustedForWidth);
[minHeight, ] = themeNode.adjust_preferred_height(minHeight, natHeight);
let [minHeight] = showAppsButton.get_preferred_height(adjustedForWidth);
[minHeight] = themeNode.adjust_preferred_height(minHeight, natHeight);
return [minHeight, natHeight];
}

View File

@ -276,7 +276,7 @@ var IconGrid = GObject.registerClass({
if (forWidth < 0)
nColumns = children.length;
else
[nColumns, ] = this._computeLayout(forWidth);
[nColumns] = this._computeLayout(forWidth);
let nRows;
if (nColumns > 0)
@ -504,7 +504,7 @@ var IconGrid = GObject.registerClass({
this._clonesAnimating.push(actorClone);
Main.uiGroup.add_actor(actorClone);
let [width, height,,] = this._getAllocatedChildSizeAndSpacing(actor);
let [width, height] = this._getAllocatedChildSizeAndSpacing(actor);
actorClone.set_size(width, height);
let scaleX = sourceScaledWidth / width;
let scaleY = sourceScaledHeight / height;

View File

@ -133,7 +133,7 @@ var SlidingControl = class {
getVisibleWidth() {
let child = this.actor.get_first_child();
let [, , natWidth, ] = child.get_preferred_size();
let [, , natWidth] = child.get_preferred_size();
return natWidth;
}

View File

@ -539,7 +539,7 @@ var InputSourceManager = class {
let exists = false;
if (type == INPUT_SOURCE_TYPE_XKB) {
[exists, displayName, shortName, , ] =
[exists, displayName, shortName] =
this._xkbInfo.get_layout_info(id);
} else if (type == INPUT_SOURCE_TYPE_IBUS) {
if (this._disableIBus)
@ -564,7 +564,7 @@ var InputSourceManager = class {
if (infosList.length == 0) {
let type = INPUT_SOURCE_TYPE_XKB;
let id = KeyboardManager.DEFAULT_LAYOUT;
let [ , displayName, shortName, , ] = this._xkbInfo.get_layout_info(id);
let [ , displayName, shortName] = this._xkbInfo.get_layout_info(id);
infosList.push({ type: type, id: id, displayName: displayName, shortName: shortName });
}

View File

@ -525,8 +525,8 @@ var SwitcherList = GObject.registerClass({
vfunc_get_preferred_width(forHeight) {
let themeNode = this.get_theme_node();
let [maxChildMin, ] = this._maxChildWidth(forHeight);
let [minListWidth, ] = this._list.get_preferred_width(forHeight);
let [maxChildMin] = this._maxChildWidth(forHeight);
let [minListWidth] = this._list.get_preferred_width(forHeight);
return themeNode.adjust_preferred_width(maxChildMin, minListWidth);
}