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/layer_viewer/LayerDetailsView.js b/front_end/layer_viewer/LayerDetailsView.js
index 8daae62..e2cd8b7 100644
--- a/front_end/layer_viewer/LayerDetailsView.js
+++ b/front_end/layer_viewer/LayerDetailsView.js
@@ -57,8 +57,9 @@
    */
   selectObject(selection) {
     this._selection = selection;
-    if (this.isShowing())
+    if (this.isShowing()) {
       this.update();
+    }
   }
 
   /**
@@ -81,14 +82,16 @@
    * @param {!Event} event
    */
   _onScrollRectClicked(index, event) {
-    if (event.which !== 1)
+    if (event.which !== 1) {
       return;
+    }
     this._layerViewHost.selectObject(new LayerViewer.LayerView.ScrollRectSelection(this._selection.layer(), index));
   }
 
   _onPaintProfilerButtonClicked() {
-    if (this._selection.type() === LayerViewer.LayerView.Selection.Type.Snapshot || this._selection.layer())
+    if (this._selection.type() === LayerViewer.LayerView.Selection.Type.Snapshot || this._selection.layer()) {
       this.dispatchEventToListeners(LayerViewer.LayerDetailsView.Events.PaintProfilerRequested, this._selection);
+    }
   }
 
   /**
@@ -96,11 +99,13 @@
    * @param {number} index
    */
   _createScrollRectElement(scrollRect, index) {
-    if (index)
+    if (index) {
       this._scrollRectsCell.createTextChild(', ');
+    }
     const element = this._scrollRectsCell.createChild('span', 'scroll-rect');
-    if (this._selection.scrollRectIndex === index)
+    if (this._selection.scrollRectIndex === index) {
       element.classList.add('active');
+    }
     element.textContent = Common.UIString(
         '%s %d × %d (at %d, %d)', LayerViewer.LayerDetailsView._slowScrollRectNames.get(scrollRect.type),
         scrollRect.rect.x, scrollRect.rect.y, scrollRect.rect.width, scrollRect.rect.height);
@@ -113,8 +118,9 @@
    * @return {string}
    */
   _formatStickyAncestorLayer(title, layer) {
-    if (!layer)
+    if (!layer) {
       return '';
+    }
 
     const node = layer.nodeForSelfOrAncestor();
     const name = node ? node.simpleSelector() : Common.UIString('<unnamed>');
@@ -126,8 +132,9 @@
    * @param {?SDK.Layer} layer
    */
   _createStickyAncestorChild(title, layer) {
-    if (!layer)
+    if (!layer) {
       return;
+    }
 
     this._stickyPositionConstraintCell.createTextChild(', ');
     const child = this._stickyPositionConstraintCell.createChild('span');
@@ -139,8 +146,9 @@
    */
   _populateStickyPositionConstraintCell(constraint) {
     this._stickyPositionConstraintCell.removeChildren();
-    if (!constraint)
+    if (!constraint) {
       return;
+    }
 
     const stickyBoxRect = constraint.stickyBoxRect();
     const stickyBoxRectElement = this._stickyPositionConstraintCell.createChild('span');
@@ -224,8 +232,9 @@
     for (let i = 0; i < compositingReasons.length; ++i) {
       let text = LayerViewer.LayerDetailsView.CompositingReasonDetail[compositingReasons[i]] || compositingReasons[i];
       // If the text is more than one word but does not terminate with period, add the period.
-      if (/\s.*[^.]$/.test(text))
+      if (/\s.*[^.]$/.test(text)) {
         text += '.';
+      }
       list.createChild('li').textContent = text;
     }
   }