Run ESLint on the scripts directory

We weren't running ESLint on this directory and, as it turns out, there
are quite a few linter errors in this folder.

R=jacktfranklin@chromium.org

Change-Id: Ic6cb9f6ad4858f69114e0c433a954041215b49e2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2096705
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
diff --git a/scripts/utils.js b/scripts/utils.js
index b2b76d2..2cc5f03 100644
--- a/scripts/utils.js
+++ b/scripts/utils.js
@@ -2,21 +2,21 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-var fs = require('fs');
-var http = require('http');
-var https = require('https');
-var path = require('path');
-var parseURL = require('url').parse;
-var shell = require('child_process').execSync;
-var Stream = require('stream').Transform;
+const fs = require('fs');
+const http = require('http');
+const https = require('https');
+const path = require('path');
+const parseURL = require('url').parse;
+const shell = require('child_process').execSync;
+const Stream = require('stream').Transform;
 
 function fetch(url) {
   return new Promise(fetchPromise);
 
   function fetchPromise(resolve, reject) {
-    var request;
-    var protocol = parseURL(url).protocol;
-    var handleResponse = getCallback.bind(null, resolve, reject);
+    let request;
+    const protocol = parseURL(url).protocol;
+    const handleResponse = getCallback.bind(null, resolve, reject);
     if (protocol === 'https:') {
       request = https.get(url, handleResponse);
     } else if (protocol === 'http:') {
@@ -33,7 +33,7 @@
       reject(new Error(`Request error: + ${response.statusCode}`));
       return;
     }
-    var body = new Stream();
+    const body = new Stream();
     response.on('data', chunk => body.push(chunk));
     response.on('end', () => resolve(body.read()));
   }
@@ -61,7 +61,7 @@
 
 function copy(src, dest) {
   try {
-    var targetFilePath = path.resolve(dest, path.basename(src));
+    const targetFilePath = path.resolve(dest, path.basename(src));
     fs.writeFileSync(targetFilePath, fs.readFileSync(src));
   } catch (error) {
     throw new Error(`Received an error: [${error}] while trying to copy: ${src} -> ${dest}`);
@@ -74,17 +74,18 @@
       copy(src, dest);
       return;
     }
-    var targetDirPath = path.resolve(dest, path.basename(src));
-    if (!fs.existsSync(targetDirPath))
+    const targetDirPath = path.resolve(dest, path.basename(src));
+    if (!fs.existsSync(targetDirPath)) {
       fs.mkdirSync(targetDirPath);
+    }
     if (isDir(src)) {
-      var files = fs.readdirSync(src);
-      for (var i = 0; i < files.length; i++) {
-        var childPath = path.resolve(src, files[i]);
+      const files = fs.readdirSync(src);
+      for (let i = 0; i < files.length; i++) {
+        const childPath = path.resolve(src, files[i]);
         if (isDir(childPath)) {
           copyRecursive(childPath, targetDirPath);
         } else {
-          var targetFilePath = path.resolve(targetDirPath, path.basename(childPath));
+          const targetFilePath = path.resolve(targetDirPath, path.basename(childPath));
           fs.writeFileSync(targetFilePath, fs.readFileSync(childPath));
         }
       }
@@ -101,13 +102,14 @@
         fs.unlinkSync(filePath);
         return;
       }
-      var files = fs.readdirSync(filePath);
-      for (var i = 0; i < files.length; i++) {
-        var childPath = path.resolve(filePath, files[i]);
-        if (isDir(childPath))
+      const files = fs.readdirSync(filePath);
+      for (let i = 0; i < files.length; i++) {
+        const childPath = path.resolve(filePath, files[i]);
+        if (isDir(childPath)) {
           removeRecursive(childPath);
-        else
+        } else {
           fs.unlinkSync(childPath);
+        }
       }
       fs.rmdirSync(filePath);
     }
@@ -125,16 +127,25 @@
 }
 
 function parseArgs(args) {
-  var argObject = {};
-  for (var i = 0; i < args.length; i++) {
-    var arg = args[i];
-    var components = arg.split('=');
-    var key = components[0];
+  const argObject = {};
+  for (let i = 0; i < args.length; i++) {
+    const arg = args[i];
+    const components = arg.split('=');
+    const key = components[0];
     argObject[key] = components[1] || true;
   }
   return argObject;
 }
 
 module.exports = {
-    fetch, atob, isFile, isDir, copy, copyRecursive, removeRecursive, includes, shellOutput, parseArgs,
-};
\ No newline at end of file
+  fetch,
+  atob,
+  isFile,
+  isDir,
+  copy,
+  copyRecursive,
+  removeRecursive,
+  includes,
+  shellOutput,
+  parseArgs,
+};