[gnome-shell] style: Allow lonely ifs where appropriate



commit a32c4f30d15e2aec3b93947e0ea7cb3138babe13
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Aug 20 04:24:37 2019 +0200

    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

 js/gdm/util.js          | 1 +
 js/misc/util.js         | 2 +-
 js/ui/magnifier.js      | 1 +
 js/ui/overview.js       | 1 +
 js/ui/status/network.js | 1 +
 js/ui/windowManager.js  | 2 +-
 6 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/js/gdm/util.js b/js/gdm/util.js
index 107e8f7765..824b301b97 100644
--- a/js/gdm/util.js
+++ b/js/gdm/util.js
@@ -544,6 +544,7 @@ var ShellUserVerifier = class {
                 });
             }
         } else {
+            // eslint-disable-next-line no-lonely-if
             if (!this.hasPendingMessages) {
                 this._cancelAndReset();
             } else {
diff --git a/js/misc/util.js b/js/misc/util.js
index cbbd4455a1..b7ee017982 100644
--- a/js/misc/util.js
+++ b/js/misc/util.js
@@ -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
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index 9f8ee2825c..a5e6c22d77 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -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();
         }
diff --git a/js/ui/overview.js b/js/ui/overview.js
index dc9565d021..3f22a47b4e 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -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;
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 65dc78a22f..2f9cd0e2b6 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -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
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index e6d6d60f01..41544ee7bd 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]