From 15aea9e9ea962dbb74af51ecb3aa906a9db7331e Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Tue, 2 May 2017 23:06:28 +0100 Subject: [PATCH] auto-fix prefer-const --- src/core/operations/Code.js | 8 ++++---- src/core/operations/StrUtils.js | 4 ++-- src/web/ControlsWaiter.js | 4 ++-- test/TestRegister.js | 4 ++-- test/index.js | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/core/operations/Code.js b/src/core/operations/Code.js index f7b72f5e..c1df6714 100755 --- a/src/core/operations/Code.js +++ b/src/core/operations/Code.js @@ -426,7 +426,7 @@ const Code = { * @returns {string} */ _replaceVariableNames(input, replacer) { - let tokenRegex = /\\"|"(?:\\"|[^"])*"|(\b[a-z0-9\-_]+\b)/ig; + const tokenRegex = /\\"|"(?:\\"|[^"])*"|(\b[a-z0-9\-_]+\b)/ig; return input.replace(tokenRegex, (...args) => { let match = args[0], @@ -450,7 +450,7 @@ const Code = { * */ runToSnakeCase(input, args) { - let smart = args[0]; + const smart = args[0]; if (smart) { return Code._replaceVariableNames(input, snakeCase); @@ -469,7 +469,7 @@ const Code = { * */ runToCamelCase(input, args) { - let smart = args[0]; + const smart = args[0]; if (smart) { return Code._replaceVariableNames(input, camelCase); @@ -488,7 +488,7 @@ const Code = { * */ runToKebabCase(input, args) { - let smart = args[0]; + const smart = args[0]; if (smart) { return Code._replaceVariableNames(input, kebabCase); diff --git a/src/core/operations/StrUtils.js b/src/core/operations/StrUtils.js index 4203efa6..1eed465a 100755 --- a/src/core/operations/StrUtils.js +++ b/src/core/operations/StrUtils.js @@ -471,7 +471,7 @@ const StrUtils = { number = args[1]; delimiter = Utils.charRep[delimiter]; - let splitInput = input.split(delimiter); + const splitInput = input.split(delimiter); return splitInput .filter((line, lineIndex) => { @@ -499,7 +499,7 @@ const StrUtils = { number = args[1]; delimiter = Utils.charRep[delimiter]; - let splitInput = input.split(delimiter); + const splitInput = input.split(delimiter); return splitInput .filter((line, lineIndex) => { diff --git a/src/web/ControlsWaiter.js b/src/web/ControlsWaiter.js index 3f22b742..1af61e74 100755 --- a/src/web/ControlsWaiter.js +++ b/src/web/ControlsWaiter.js @@ -244,8 +244,8 @@ ControlsWaiter.prototype.loadClick = function() { * Saves the recipe specified in the save textarea to local storage. */ ControlsWaiter.prototype.saveButtonClick = function() { - let recipeName = Utils.escapeHtml(document.getElementById("save-name").value); - let recipeStr = document.getElementById("save-text").value; + const recipeName = Utils.escapeHtml(document.getElementById("save-name").value); + const recipeStr = document.getElementById("save-text").value; if (!recipeName) { this.app.alert("Please enter a recipe name", "danger", 2000); diff --git a/test/TestRegister.js b/test/TestRegister.js index 3088c8fe..a66d65f2 100644 --- a/test/TestRegister.js +++ b/test/TestRegister.js @@ -38,7 +38,7 @@ import Chef from "../src/core/Chef.js"; TestRegister.prototype.runTests = function() { return Promise.all( this.tests.map(function(test, i) { - let chef = new Chef(); + const chef = new Chef(); return Promise.resolve(chef.bake( test.input, @@ -48,7 +48,7 @@ import Chef from "../src/core/Chef.js"; false )) .then(function(result) { - let ret = { + const ret = { test: test, status: null, output: null, diff --git a/test/index.js b/test/index.js index 2543a33d..d5037a78 100644 --- a/test/index.js +++ b/test/index.js @@ -32,7 +32,7 @@ let allTestsPassing = true, * @returns {string} */ function statusToIcon(status) { - let icons = { + const icons = { erroring: "🔥", failing: "❌", passing: "✔️️", @@ -48,7 +48,7 @@ function statusToIcon(status) { */ function handleTestResult(testResult) { allTestsPassing = allTestsPassing && testResult.status === "passing"; - let newCount = (testStatusCounts[testResult.status] || 0) + 1; + const newCount = (testStatusCounts[testResult.status] || 0) + 1; testStatusCounts[testResult.status] = newCount; testStatusCounts.total += 1; @@ -83,8 +83,8 @@ TestRegister.runTests() console.log("\n"); - for (let testStatus in testStatusCounts) { - let count = testStatusCounts[testStatus]; + for (const testStatus in testStatusCounts) { + const count = testStatusCounts[testStatus]; if (count > 0) { console.log(testStatus.toUpperCase(), count); }