Always add braces to single-line if-statements

The Chromium/Google style guides does not enforce curly braces for
single-line if-statements, but does strongly recommend doing so. Adding
braces will improve code readability, by visually separating code
blocks. This will also prevent issues where accidental additions are
pushed to the "else"-clause instead of in the if-block.

This CL also updates the presubmit `eslint` to run the fix with the
correct configuration. It will now fix all issues it can fix.

Change-Id: I4b616f21a99393f168dec743c0bcbdc7f5db04a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1821526
Commit-Queue: Tim Van der Lippe <[email protected]>
Reviewed-by: Yang Guo <[email protected]>
Reviewed-by: Jeff Fisher <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#701070}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 7e0bdbe2d7f9fc2386bfaefda3cc29c66ccc18f9
diff --git a/front_end/ui/ListWidget.js b/front_end/ui/ListWidget.js
index 119b60d..11e9989 100644
--- a/front_end/ui/ListWidget.js
+++ b/front_end/ui/ListWidget.js
@@ -52,8 +52,9 @@
    * @param {boolean} editable
    */
   appendItem(item, editable) {
-    if (this._lastSeparator && this._items.length)
+    if (this._lastSeparator && this._items.length) {
       this._list.appendChild(createElementWithClass('div', 'list-separator'));
+    }
     this._lastSeparator = false;
 
     this._items.push(item);
@@ -77,8 +78,9 @@
    * @param {number} index
    */
   removeItem(index) {
-    if (this._editItem === this._items[index])
+    if (this._editItem === this._items[index]) {
       this._stopEditing();
+    }
 
     const element = this._elements[index];
 
@@ -88,10 +90,12 @@
     const next = element.nextElementSibling;
     const nextIsSeparator = next && next.classList.contains('list-separator');
 
-    if (previousIsSeparator && (nextIsSeparator || !next))
+    if (previousIsSeparator && (nextIsSeparator || !next)) {
       previous.remove();
-    if (nextIsSeparator && !previous)
+    }
+    if (nextIsSeparator && !previous) {
       next.remove();
+    }
     element.remove();
 
     this._elements.splice(index, 1);
@@ -167,13 +171,15 @@
   }
 
   _updatePlaceholder() {
-    if (!this._emptyPlaceholder)
+    if (!this._emptyPlaceholder) {
       return;
+    }
 
-    if (!this._elements.length && !this._editor)
+    if (!this._elements.length && !this._editor) {
       this._list.appendChild(this._emptyPlaceholder);
-    else
+    } else {
       this._emptyPlaceholder.remove();
+    }
   }
 
   /**
@@ -182,8 +188,9 @@
    * @param {?Element} insertionPoint
    */
   _startEditing(item, element, insertionPoint) {
-    if (element && this._editElement === element)
+    if (element && this._editElement === element) {
       return;
+    }
 
     this._stopEditing();
     this._focusRestorer = new UI.ElementFocusRestorer(this.element);
@@ -191,8 +198,9 @@
     this._list.classList.add('list-editing');
     this._editItem = item;
     this._editElement = element;
-    if (element)
+    if (element) {
       element.classList.add('hidden');
+    }
 
     const index = element ? this._elements.indexOf(element) : -1;
     this._editor = this._delegate.beginEdit(item);
@@ -213,12 +221,15 @@
 
   _stopEditing() {
     this._list.classList.remove('list-editing');
-    if (this._focusRestorer)
+    if (this._focusRestorer) {
       this._focusRestorer.restore();
-    if (this._editElement)
+    }
+    if (this._editElement) {
       this._editElement.classList.remove('hidden');
-    if (this._editor && this._editor.element.parentElement)
+    }
+    if (this._editor && this._editor.element.parentElement) {
       this._editor.element.remove();
+    }
 
     this._editor = null;
     this._editItem = null;
@@ -383,13 +394,15 @@
       const {valid, errorMessage} = this._validators[index].call(null, this._item, this._index, input);
 
       input.classList.toggle('error-input', !valid && !forceValid);
-      if (valid || forceValid)
+      if (valid || forceValid) {
         UI.ARIAUtils.setInvalid(input, false);
-      else
+      } else {
         UI.ARIAUtils.setInvalid(input, true);
+      }
 
-      if (!forceValid && errorMessage && !this._errorMessageContainer.textContent)
+      if (!forceValid && errorMessage && !this._errorMessageContainer.textContent) {
         this._errorMessageContainer.textContent = errorMessage;
+      }
 
       allValid &= valid;
     }
@@ -411,14 +424,16 @@
 
     this._commitButton.textContent = commitButtonTitle;
     this.element.scrollIntoViewIfNeeded(false);
-    if (this._controls.length)
+    if (this._controls.length) {
       this._controls[0].focus();
+    }
     this._validateControls(true);
   }
 
   _commitClicked() {
-    if (this._commitButton.disabled)
+    if (this._commitButton.disabled) {
       return;
+    }
 
     const commit = this._commit;
     this._commit = null;