style: Stop using braces for single-line arrow functions
Braces are optional for single-line arrow functions, but there's a subtle difference: Without braces, the expression is implicitly used as return value; with braces, the function returns nothing unless there's an explicit return. We currently reflect that in our style by only omitting braces when the function is expected to have a return value, but that's not very obvious, not an important differentiation to make, and not easy to express in an automatic rule. So just omit braces consistently as mandated by gjs' coding style. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/57
This commit is contained in:
@@ -529,7 +529,7 @@ class ApplicationsButton extends PanelMenu.Button {
|
||||
Main.wm.setCustomKeybindingHandler('panel-main-menu',
|
||||
Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.OVERVIEW,
|
||||
() => { this.menu.toggle(); });
|
||||
() => this.menu.toggle());
|
||||
}
|
||||
|
||||
_redisplay() {
|
||||
@@ -616,8 +616,8 @@ class ApplicationsButton extends PanelMenu.Button {
|
||||
style_class: 'vfade' });
|
||||
this.categoriesScrollBox.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
|
||||
vscroll = this.categoriesScrollBox.get_vscroll_bar();
|
||||
vscroll.connect('scroll-start', () => { this.menu.passEvents = true; });
|
||||
vscroll.connect('scroll-stop', () => { this.menu.passEvents = false; });
|
||||
vscroll.connect('scroll-start', () => this.menu.passEvents = true);
|
||||
vscroll.connect('scroll-stop', () => this.menu.passEvents = false);
|
||||
this.leftBox.add(this.categoriesScrollBox, { expand: true,
|
||||
x_fill: true, y_fill: true,
|
||||
y_align: St.Align.START });
|
||||
|
||||
@@ -125,9 +125,9 @@ function myCheckWorkspaces() {
|
||||
}
|
||||
|
||||
// make sure the original method only removes empty workspaces at the end
|
||||
keepAliveWorkspaces.forEach(ws => { ws._keepAliveId = 1; });
|
||||
keepAliveWorkspaces.forEach(ws => ws._keepAliveId = 1);
|
||||
prevCheckWorkspaces.call(this);
|
||||
keepAliveWorkspaces.forEach(ws => { delete ws._keepAliveId; });
|
||||
keepAliveWorkspaces.forEach(ws => delete ws._keepAliveId);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class PlaceInfo {
|
||||
} catch (e) {
|
||||
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_MOUNTED)) {
|
||||
let source = {
|
||||
get_icon: () => { return this.icon; }
|
||||
get_icon: () => this.icon
|
||||
};
|
||||
let op = new ShellMountOperation.ShellMountOperation(source);
|
||||
this.file.mount_enclosing_volume(0, op.mountOp, null, (file, result) => {
|
||||
@@ -325,7 +325,7 @@ var PlacesManager = class {
|
||||
}
|
||||
|
||||
_updateSpecials() {
|
||||
this._places.special.forEach(p => { p.destroy(); });
|
||||
this._places.special.forEach(p => p.destroy());
|
||||
this._places.special = [];
|
||||
|
||||
let homePath = GLib.get_home_dir();
|
||||
@@ -367,9 +367,9 @@ var PlacesManager = class {
|
||||
let networkMounts = [];
|
||||
let networkVolumes = [];
|
||||
|
||||
this._places.devices.forEach(p => { p.destroy(); });
|
||||
this._places.devices.forEach(p => p.destroy());
|
||||
this._places.devices = [];
|
||||
this._places.network.forEach(p => { p.destroy(); });
|
||||
this._places.network.forEach(p => p.destroy());
|
||||
this._places.network = [];
|
||||
|
||||
/* Add standard places */
|
||||
|
||||
@@ -401,13 +401,13 @@ class AppContextMenu extends PopupMenu.PopupMenu {
|
||||
|
||||
this._minimizeItem = new PopupMenu.PopupMenuItem(_("Minimize all"));
|
||||
this._minimizeItem.connect('activate', () => {
|
||||
this._appButton.getWindowList().forEach(w => { w.minimize(); });
|
||||
this._appButton.getWindowList().forEach(w => w.minimize());
|
||||
});
|
||||
this.addMenuItem(this._minimizeItem);
|
||||
|
||||
this._unminimizeItem = new PopupMenu.PopupMenuItem(_("Unminimize all"));
|
||||
this._unminimizeItem.connect('activate', () => {
|
||||
this._appButton.getWindowList().forEach(w => { w.unminimize(); });
|
||||
this._appButton.getWindowList().forEach(w => w.unminimize());
|
||||
});
|
||||
this.addMenuItem(this._unminimizeItem);
|
||||
|
||||
@@ -538,7 +538,7 @@ class AppButton extends BaseButton {
|
||||
let rect = this._getIconGeometry();
|
||||
|
||||
let windows = this.app.get_windows();
|
||||
windows.forEach(w => { w.set_icon_geometry(rect); });
|
||||
windows.forEach(w => w.set_icon_geometry(rect));
|
||||
}
|
||||
|
||||
getWindowList() {
|
||||
@@ -1205,7 +1205,7 @@ class Extension {
|
||||
}
|
||||
|
||||
_buildWindowLists() {
|
||||
this._windowLists.forEach(list => { list.actor.destroy(); });
|
||||
this._windowLists.forEach(list => list.actor.destroy());
|
||||
this._windowLists = [];
|
||||
|
||||
let showOnAllMonitors = this._settings.get_boolean('show-on-all-monitors');
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
{
|
||||
"rules": {
|
||||
"arrow-spacing": "error",
|
||||
"brace-style": [
|
||||
"error",
|
||||
"1tbs",
|
||||
{
|
||||
"allowSingleLine": true
|
||||
}
|
||||
],
|
||||
"camelcase": [
|
||||
"error",
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user