auto-fix prefer-const

This commit is contained in:
Thomas Grainger 2017-05-02 23:06:28 +01:00
parent 5b03a84be8
commit 15aea9e9ea
No known key found for this signature in database
GPG key ID: 995EA0A029283160
5 changed files with 14 additions and 14 deletions

View file

@ -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);

View file

@ -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) => {

View file

@ -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);

View file

@ -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,

View file

@ -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);
}