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 themeNode = this.get_theme_node();
let adjustedForWidth = themeNode.adjust_for_width(forWidth); let adjustedForWidth = themeNode.adjust_for_width(forWidth);
let [, showAppsButton] = this.get_children(); let [, showAppsButton] = this.get_children();
let [minHeight, ] = showAppsButton.get_preferred_height(adjustedForWidth); let [minHeight] = showAppsButton.get_preferred_height(adjustedForWidth);
[minHeight, ] = themeNode.adjust_preferred_height(minHeight, natHeight); [minHeight] = themeNode.adjust_preferred_height(minHeight, natHeight);
return [minHeight, natHeight]; return [minHeight, natHeight];
} }

View File

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

View File

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

View File

@ -539,7 +539,7 @@ var InputSourceManager = class {
let exists = false; let exists = false;
if (type == INPUT_SOURCE_TYPE_XKB) { if (type == INPUT_SOURCE_TYPE_XKB) {
[exists, displayName, shortName, , ] = [exists, displayName, shortName] =
this._xkbInfo.get_layout_info(id); this._xkbInfo.get_layout_info(id);
} else if (type == INPUT_SOURCE_TYPE_IBUS) { } else if (type == INPUT_SOURCE_TYPE_IBUS) {
if (this._disableIBus) if (this._disableIBus)
@ -564,7 +564,7 @@ var InputSourceManager = class {
if (infosList.length == 0) { if (infosList.length == 0) {
let type = INPUT_SOURCE_TYPE_XKB; let type = INPUT_SOURCE_TYPE_XKB;
let id = KeyboardManager.DEFAULT_LAYOUT; 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 }); 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) { vfunc_get_preferred_width(forHeight) {
let themeNode = this.get_theme_node(); let themeNode = this.get_theme_node();
let [maxChildMin, ] = this._maxChildWidth(forHeight); let [maxChildMin] = this._maxChildWidth(forHeight);
let [minListWidth, ] = this._list.get_preferred_width(forHeight); let [minListWidth] = this._list.get_preferred_width(forHeight);
return themeNode.adjust_preferred_width(maxChildMin, minListWidth); return themeNode.adjust_preferred_width(maxChildMin, minListWidth);
} }