cleanup: Don't linebreak before closing parentheses

Otherwise recent versions of eslint want "dangling" commas,
which is at least ugly considering that most functions don't
allow adding arguments at leasure.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1177
This commit is contained in:
Florian Müllner 2020-04-04 01:52:29 +02:00 committed by verdre
parent 2e80995f19
commit 153b7d525d
19 changed files with 49 additions and 87 deletions

View File

@ -24,8 +24,7 @@ function getCompletions(text, commandHeader, globalCompletionList) {
[expr_, base, attrHead] = matches;
methods = getPropertyNamesFromExpression(base, commandHeader).filter(
attr => attr.slice(0, attrHead.length) == attrHead
);
attr => attr.slice(0, attrHead.length) === attrHead);
}
// Look for the empty expression or partially entered words
@ -34,8 +33,7 @@ function getCompletions(text, commandHeader, globalCompletionList) {
if (text == '' || matches) {
[expr_, attrHead] = matches;
methods = globalCompletionList.filter(
attr => attr.slice(0, attrHead.length) == attrHead
);
attr => attr.slice(0, attrHead.length) === attrHead);
}
}

View File

@ -681,8 +681,7 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
// Cache the window list now; we don't handle dynamic changes here,
// and we don't want to be continually retrieving it
appIcon.cachedWindows = allWindows.filter(
w => windowTracker.get_window_app(w) == appIcon.app
);
w => windowTracker.get_window_app(w) === appIcon.app);
if (appIcon.cachedWindows.length > 0)
this._addIcon(appIcon);
}

View File

@ -669,8 +669,7 @@ var AllView = GObject.registerClass({
this._canScroll = true;
this._scrollTimeoutId = 0;
return GLib.SOURCE_REMOVE;
}
);
});
return Clutter.EVENT_STOP;
}
@ -1323,8 +1322,7 @@ var AppSearchProvider = class AppSearchProvider {
return app && this._parentalControlsManager.shouldShowApp(app.app_info);
});
results = results.concat(group.sort(
(a, b) => usage.compare(a, b)
));
(a, b) => usage.compare(a, b)));
});
results = results.concat(this._systemActions.getMatchingActions(terms));
@ -2498,14 +2496,12 @@ var AppIconMenu = class AppIconMenu extends PopupMenu.PopupMenu {
this.removeAll();
let windows = this._source.app.get_windows().filter(
w => !w.skip_taskbar
);
w => !w.skip_taskbar);
if (windows.length > 0) {
this.addMenuItem(
/* Translators: This is the heading of a list of open windows */
new PopupMenu.PopupSeparatorMenuItem(_("Open Windows"))
);
new PopupMenu.PopupSeparatorMenuItem(_('Open Windows')));
}
windows.forEach(window => {

View File

@ -147,9 +147,8 @@ var AudioDeviceSelectionDBus = class AudioDeviceSelectionDBus {
_onDeviceSelected(dialog, device) {
let connection = this._dbusImpl.get_connection();
let info = this._dbusImpl.get_info();
let deviceName = Object.keys(AudioDevice).filter(
dev => AudioDevice[dev] == device
)[0].toLowerCase();
const deviceName = Object.keys(AudioDevice)
.filter(dev => AudioDevice[dev] === device)[0].toLowerCase();
connection.emit_signal(this._audioSelectionDialog._sender,
this._dbusImpl.get_object_path(),
info ? info.name : null,

View File

@ -13,17 +13,13 @@ var ComponentManager = class {
_sessionUpdated() {
let newEnabledComponents = Main.sessionMode.components;
newEnabledComponents.filter(
name => !this._enabledComponents.includes(name)
).forEach(name => {
this._enableComponent(name);
});
newEnabledComponents
.filter(name => !this._enabledComponents.includes(name))
.forEach(name => this._enableComponent(name));
this._enabledComponents.filter(
name => !newEnabledComponents.includes(name)
).forEach(name => {
this._disableComponent(name);
});
this._enabledComponents
.filter(name => !newEnabledComponents.includes(name))
.forEach(name => this._disableComponent(name));
this._enabledComponents = newEnabledComponents;
}

View File

@ -125,8 +125,7 @@ var ContentTypeDiscoverer = class {
_emitCallback(mount, contentTypes = []) {
// we're not interested in win32 software content types here
contentTypes = contentTypes.filter(
type => type != 'x-content/win32-software'
);
type => type !== 'x-content/win32-software');
let apps = [];
contentTypes.forEach(type => {

View File

@ -463,19 +463,15 @@ var ExtensionManager = class {
// Find and enable all the newly enabled extensions: UUIDs found in the
// new setting, but not in the old one.
newEnabledExtensions.filter(
uuid => !this._enabledExtensions.includes(uuid)
).forEach(uuid => {
this._callExtensionEnable(uuid);
});
newEnabledExtensions
.filter(uuid => !this._enabledExtensions.includes(uuid))
.forEach(uuid => this._callExtensionEnable(uuid));
// Find and disable all the newly disabled extensions: UUIDs found in the
// old setting, but not in the new one.
this._extensionOrder.filter(
uuid => !newEnabledExtensions.includes(uuid)
).reverse().forEach(uuid => {
this._callExtensionDisable(uuid);
});
this._extensionOrder
.filter(uuid => !newEnabledExtensions.includes(uuid))
.reverse().forEach(uuid => this._callExtensionDisable(uuid));
this._enabledExtensions = newEnabledExtensions;
}

View File

@ -935,8 +935,7 @@ var EmojiSelection = GObject.registerClass({
this.add_child(this._emojiPager);
this._pageIndicator = new PageIndicators.PageIndicators(
Clutter.Orientation.HORIZONTAL
);
Clutter.Orientation.HORIZONTAL);
this.add_child(this._pageIndicator);
this._pageIndicator.setReactive(false);

View File

@ -27,13 +27,11 @@ var RadialShaderEffect = GObject.registerClass({
'brightness': GObject.ParamSpec.float(
'brightness', 'brightness', 'brightness',
GObject.ParamFlags.READWRITE,
0, 1, 1
),
0, 1, 1),
'sharpness': GObject.ParamSpec.float(
'sharpness', 'sharpness', 'sharpness',
GObject.ParamFlags.READWRITE,
0, 1, 0
),
0, 1, 0),
},
}, class RadialShaderEffect extends Shell.GLSLEffect {
_init(params) {

View File

@ -39,8 +39,7 @@ function _getAutoCompleteGlobalKeywords() {
const keywords = ['true', 'false', 'null', 'new'];
// Don't add the private properties of globalThis (i.e., ones starting with '_')
const windowProperties = Object.getOwnPropertyNames(globalThis).filter(
a => a.charAt(0) != '_'
);
a => a.charAt(0) !== '_');
const headerProperties = JsParse.getDeclaredConstants(commandHeader);
return keywords.concat(windowProperties).concat(headerProperties);

View File

@ -643,8 +643,7 @@ var Magnifier = class Magnifier {
// Applies only to the first zoom region.
if (this._zoomRegions.length) {
this._zoomRegions[0].setClampScrollingAtEdges(
!this._settings.get_boolean(CLAMP_MODE_KEY)
);
!this._settings.get_boolean(CLAMP_MODE_KEY));
}
}
@ -652,8 +651,7 @@ var Magnifier = class Magnifier {
// Applies only to the first zoom region.
if (this._zoomRegions.length) {
this._zoomRegions[0].setMouseTrackingMode(
this._settings.get_enum(MOUSE_TRACKING_KEY)
);
this._settings.get_enum(MOUSE_TRACKING_KEY));
}
}
@ -661,8 +659,7 @@ var Magnifier = class Magnifier {
// Applies only to the first zoom region.
if (this._zoomRegions.length) {
this._zoomRegions[0].setFocusTrackingMode(
this._settings.get_enum(FOCUS_TRACKING_KEY)
);
this._settings.get_enum(FOCUS_TRACKING_KEY));
}
}
@ -670,8 +667,7 @@ var Magnifier = class Magnifier {
// Applies only to the first zoom region.
if (this._zoomRegions.length) {
this._zoomRegions[0].setCaretTrackingMode(
this._settings.get_enum(CARET_TRACKING_KEY)
);
this._settings.get_enum(CARET_TRACKING_KEY));
}
}
@ -679,8 +675,7 @@ var Magnifier = class Magnifier {
// Applies only to the first zoom region.
if (this._zoomRegions.length) {
this._zoomRegions[0].setInvertLightness(
this._settings.get_boolean(INVERT_LIGHTNESS_KEY)
);
this._settings.get_boolean(INVERT_LIGHTNESS_KEY));
}
}
@ -688,8 +683,7 @@ var Magnifier = class Magnifier {
// Applies only to the first zoom region.
if (this._zoomRegions.length) {
this._zoomRegions[0].setColorSaturation(
this._settings.get_double(COLOR_SATURATION_KEY)
);
this._settings.get_double(COLOR_SATURATION_KEY));
}
}
@ -1941,9 +1935,8 @@ var MagShaderEffects = class MagShaderEffects {
// it modifies the brightness and/or contrast.
let [cRed, cGreen, cBlue] = this._brightnessContrast.get_contrast();
this._brightnessContrast.set_enabled(
bRed != NO_CHANGE || bGreen != NO_CHANGE || bBlue != NO_CHANGE ||
cRed != NO_CHANGE || cGreen != NO_CHANGE || cBlue != NO_CHANGE
);
bRed !== NO_CHANGE || bGreen !== NO_CHANGE || bBlue !== NO_CHANGE ||
cRed !== NO_CHANGE || cGreen !== NO_CHANGE || cBlue !== NO_CHANGE);
}
/**
@ -1970,8 +1963,7 @@ var MagShaderEffects = class MagShaderEffects {
// a null first argument.
let [bRed, bGreen, bBlue] = this._brightnessContrast.get_brightness();
this._brightnessContrast.set_enabled(
cRed != NO_CHANGE || cGreen != NO_CHANGE || cBlue != NO_CHANGE ||
bRed != NO_CHANGE || bGreen != NO_CHANGE || bBlue != NO_CHANGE
);
cRed !== NO_CHANGE || cGreen !== NO_CHANGE || cBlue !== NO_CHANGE ||
bRed !== NO_CHANGE || bGreen !== NO_CHANGE || bBlue !== NO_CHANGE);
}
};

View File

@ -1160,8 +1160,7 @@ var MessageTray = GObject.registerClass({
this._onNotificationDestroy.bind(this));
this._notificationQueue.push(notification);
this._notificationQueue.sort(
(n1, n2) => n2.urgency - n1.urgency
);
(n1, n2) => n2.urgency - n1.urgency);
this.emit('queue-changed');
}
}

View File

@ -400,8 +400,7 @@ var Overview = class {
_getDesktopClone() {
let windows = global.get_window_actors().filter(
w => w.meta_window.get_window_type() == Meta.WindowType.DESKTOP
);
w => w.meta_window.get_window_type() === Meta.WindowType.DESKTOP);
if (windows.length == 0)
return null;

View File

@ -1153,10 +1153,9 @@ class Panel extends St.Widget {
_getDraggableWindowForPosition(stageX) {
let workspaceManager = global.workspace_manager;
let workspace = workspaceManager.get_active_workspace();
let allWindowsByStacking = global.display.sort_windows_by_stacking(
workspace.list_windows()
).reverse();
const windows = workspaceManager.get_active_workspace().list_windows();
const allWindowsByStacking =
global.display.sort_windows_by_stacking(windows).reverse();
return allWindowsByStacking.find(metaWindow => {
let rect = metaWindow.get_frame_rect();

View File

@ -220,8 +220,7 @@ var SearchResultsBase = GObject.registerClass({
_ensureResultActors(results, callback) {
let metasNeeded = results.filter(
resultId => this._resultDisplays[resultId] === undefined
);
resultId => this._resultDisplays[resultId] === undefined);
if (metasNeeded.length === 0) {
callback(true);

View File

@ -295,8 +295,8 @@ var ShellMountPasswordDialog = GObject.registerClass({
this._keyfilesLabel = new St.Label({ visible: false });
this._keyfilesLabel.clutter_text.set_markup(
/* Translators: %s is the Disks application */
_("To unlock a volume that uses keyfiles, use the <i>%s</i> utility instead.").format(disksApp.get_name())
);
_('To unlock a volume that uses keyfiles, use the <i>%s</i> utility instead.')
.format(disksApp.get_name()));
this._keyfilesLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
this._keyfilesLabel.clutter_text.line_wrap = true;
content.add_child(this._keyfilesLabel);
@ -464,8 +464,7 @@ var ShellMountPasswordDialog = GObject.registerClass({
/* Translators: %s is the Disks application */
_("Unable to start %s").format(app.get_name()),
/* Translators: %s is the Disks application */
_("Couldnt find the %s application").format(app.get_name())
);
_('Couldnt find the %s application').format(app.get_name()));
}
this._onCancelButton();
}

View File

@ -716,8 +716,7 @@ class NMWirelessDialog extends ModalDialog.ModalDialog {
let connections = client.get_connections();
this._connections = connections.filter(
connection => device.connection_valid(connection)
);
connection => device.connection_valid(connection));
this._apAddedId = device.connect('access-point-added', this._accessPointAdded.bind(this));
this._apRemovedId = device.connect('access-point-removed', this._accessPointRemoved.bind(this));
@ -1863,8 +1862,7 @@ class Indicator extends PanelMenu.SystemIndicator {
_syncVpnConnections() {
let activeConnections = this._client.get_active_connections() || [];
let vpnConnections = activeConnections.filter(
a => a instanceof NM.VpnConnection
);
a => a instanceof NM.VpnConnection);
vpnConnections.forEach(a => {
ensureActiveConnectionProps(a);
});

View File

@ -82,8 +82,7 @@ class Indicator extends PanelMenu.SystemIndicator {
});
let app = this._settingsApp = Shell.AppSystem.get_default().lookup_app(
'gnome-control-center.desktop'
);
'gnome-control-center.desktop');
if (app) {
let [icon, name] = [app.app_info.get_icon().names[0],
app.get_name()];

View File

@ -819,8 +819,7 @@ class WorkspacesDisplay extends St.Widget {
this._canScroll = true;
this._scrollTimeoutId = 0;
return GLib.SOURCE_REMOVE;
}
);
});
return Clutter.EVENT_STOP;
}