cleanup: Disambiguate assignments in arrow functions
As arrow functions have an implicit return value, an assignment of this.foo = bar could have been intended as a this.foo === bar comparison. To catch those errors, we will disallow these kinds of assignments unless they are marked explicitly by an extra pair of parentheses. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731
This commit is contained in:
parent
133a1e7bef
commit
b446667df6
@ -172,7 +172,7 @@ function getPropertyNamesFromExpression(expr, commandHeader = '') {
|
||||
|
||||
// Make sure propsUnique contains one key for every
|
||||
// property so we end up with a unique list of properties
|
||||
allProps.map(p => propsUnique[p] = null);
|
||||
allProps.map(p => (propsUnique[p] = null));
|
||||
}
|
||||
return Object.keys(propsUnique).sort();
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ function waitAndDraw(milliseconds) {
|
||||
cb();
|
||||
});
|
||||
|
||||
return callback => cb = callback;
|
||||
return callback => (cb = callback);
|
||||
}
|
||||
|
||||
function waitSignal(object, signal) {
|
||||
@ -69,7 +69,7 @@ function waitSignal(object, signal) {
|
||||
cb();
|
||||
});
|
||||
|
||||
return callback => cb = callback;
|
||||
return callback => (cb = callback);
|
||||
}
|
||||
|
||||
function extractBootTimestamp() {
|
||||
|
@ -147,7 +147,7 @@ var AccessDialogDBus = class {
|
||||
subtitle, body, options);
|
||||
dialog.open();
|
||||
|
||||
dialog.connect('closed', () => this._accessDialog = null);
|
||||
dialog.connect('closed', () => (this._accessDialog = null));
|
||||
|
||||
this._accessDialog = dialog;
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ var AllView = class AllView extends BaseAppView {
|
||||
opacity: 0,
|
||||
duration: VIEWS_SWITCH_TIME,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
onComplete: () => this.opacity = 255
|
||||
onComplete: () => (this.opacity = 255)
|
||||
});
|
||||
|
||||
if (animationDirection == IconGrid.AnimationDirection.OUT)
|
||||
|
@ -161,7 +161,7 @@ var AudioDeviceSelectionDBus = class AudioDeviceSelectionDBus {
|
||||
|
||||
let [deviceNames] = params;
|
||||
let devices = 0;
|
||||
deviceNames.forEach(n => devices |= AudioDevice[n.toUpperCase()]);
|
||||
deviceNames.forEach(n => (devices |= AudioDevice[n.toUpperCase()]));
|
||||
|
||||
let dialog;
|
||||
try {
|
||||
|
@ -624,7 +624,7 @@ var NetworkAgent = class {
|
||||
this._pluginDir = Gio.file_new_for_path(Config.VPNDIR);
|
||||
try {
|
||||
let monitor = this._pluginDir.monitor(Gio.FileMonitorFlags.NONE, null);
|
||||
monitor.connect('changed', () => this._vpnCacheBuilt = false);
|
||||
monitor.connect('changed', () => (this._vpnCacheBuilt = false));
|
||||
} catch (e) {
|
||||
log(`Failed to create monitor for VPN plugin dir: ${e.message}`);
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ var MessagesIndicator = class MessagesIndicator {
|
||||
|
||||
_updateCount() {
|
||||
let count = 0;
|
||||
this._sources.forEach(source => count += source.unseenCount);
|
||||
this._sources.forEach(source => (count += source.unseenCount));
|
||||
count -= Main.messageTray.queueCount;
|
||||
|
||||
this.actor.visible = (count > 0);
|
||||
|
@ -253,7 +253,7 @@ var ModalDialog = GObject.registerClass({
|
||||
opacity: 0,
|
||||
duration: FADE_OUT_DIALOG_TIME,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
onComplete: () => this.state = State.FADED_OUT
|
||||
onComplete: () => (this.state = State.FADED_OUT)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -67,7 +67,7 @@ var Ripples = class Ripples {
|
||||
delay,
|
||||
duration,
|
||||
mode: Clutter.AnimationMode.LINEAR,
|
||||
onComplete: () => ripple.visible = false
|
||||
onComplete: () => (ripple.visible = false)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1676,7 +1676,7 @@ var NMApplet = class extends PanelMenu.SystemIndicator {
|
||||
'network-transmit-receive');
|
||||
this._source.policy = new MessageTray.NotificationApplicationPolicy('gnome-network-panel');
|
||||
|
||||
this._source.connect('destroy', () => this._source = null);
|
||||
this._source.connect('destroy', () => (this._source = null));
|
||||
Main.messageTray.add(this._source);
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ var AltSwitcher = class {
|
||||
|
||||
this.actor = new St.Bin();
|
||||
this.actor.connect('destroy', this._onDestroy.bind(this));
|
||||
this.actor.connect('notify::mapped', () => this._flipped = false);
|
||||
this.actor.connect('notify::mapped', () => (this._flipped = false));
|
||||
}
|
||||
|
||||
_sync() {
|
||||
|
@ -260,7 +260,7 @@ var Indicator = class extends PanelMenu.SystemIndicator {
|
||||
if (!this._source) {
|
||||
this._source = new MessageTray.Source(_("Thunderbolt"),
|
||||
'thunderbolt-symbolic');
|
||||
this._source.connect('destroy', () => this._source = null);
|
||||
this._source.connect('destroy', () => (this._source = null));
|
||||
|
||||
Main.messageTray.add(this._source);
|
||||
}
|
||||
|
@ -1114,7 +1114,7 @@ var WindowManager = class {
|
||||
|
||||
_showPadOsd(display, device, settings, imagePath, editionMode, monitorIndex) {
|
||||
this._currentPadOsd = new PadOsd.PadOsd(device, settings, imagePath, editionMode, monitorIndex);
|
||||
this._currentPadOsd.connect('closed', () => this._currentPadOsd = null);
|
||||
this._currentPadOsd.connect('closed', () => (this._currentPadOsd = null));
|
||||
|
||||
return this._currentPadOsd.actor;
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ var WorkspacesView = class extends WorkspacesViewBase {
|
||||
this.scrollAdjustment.ease(index, {
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
duration: WORKSPACE_SWITCH_TIME,
|
||||
onComplete: () => this._animatingScroll = false
|
||||
onComplete: () => (this._animatingScroll = false)
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user