style: Allow lonely ifs where appropriate

We now have a lint rule to disallow lonely ifs, however there are
cases where the "lonely" part mirrors code from the preceding if
clause. Opt out of the lint rule in those cases.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/818
This commit is contained in:
Florian Müllner 2019-08-20 04:24:37 +02:00 committed by Georges Basile Stavracas Neto
parent 65c5cfd4dc
commit a32c4f30d1
6 changed files with 6 additions and 2 deletions

View File

@ -544,6 +544,7 @@ var ShellUserVerifier = class {
});
}
} else {
// eslint-disable-next-line no-lonely-if
if (!this.hasPendingMessages) {
this._cancelAndReset();
} else {

View File

@ -250,7 +250,7 @@ function formatTime(time, params) {
format = N_("%B %-d %Y, %H\u2236%M");
} else {
// Show only the time if date is on today
if (daysAgo < 1 || params.timeOnly)
if (daysAgo < 1 || params.timeOnly) // eslint-disable-line no-lonely-if
/* Translators: Time in 12h format */
format = N_("%l\u2236%M %p");
// Show the word "Yesterday" and time if date is on yesterday

View File

@ -346,6 +346,7 @@ var Magnifier = class Magnifier {
this.addCrosshairs();
this._crossHairs.show();
} else {
// eslint-disable-next-line no-lonely-if
if (this._crossHairs)
this._crossHairs.hide();
}

View File

@ -534,6 +534,7 @@ var Overview = class {
}
}
} else {
// eslint-disable-next-line no-lonely-if
if (this._modal) {
Main.popModal(this._overview);
this._modal = false;

View File

@ -964,6 +964,7 @@ class NMWirelessDialog extends ModalDialog.ModalDialog {
else if (wpaFlags & NM80211ApSecurityFlags.KEY_MGMT_PSK)
type = NMAccessPointSecurity.WPA_PSK;
} else {
// eslint-disable-next-line no-lonely-if
if (flags & NM80211ApFlags.PRIVACY)
type = NMAccessPointSecurity.WEP;
else

View File

@ -2124,7 +2124,7 @@ var WindowManager = class {
else
direction = Meta.MotionDirection.LEFT;
} else {
if (vertical)
if (vertical) // eslint-disable-line no-lonely-if
direction = Meta.MotionDirection.DOWN;
else if (rtl)
direction = Meta.MotionDirection.LEFT;