From 14afa1575b8500c8d4517bc95d3556640e50608a Mon Sep 17 00:00:00 2001 From: valadaptive Date: Sat, 2 Dec 2023 10:57:53 -0500 Subject: [PATCH] Enable no-redeclare lint --- .eslintrc.js | 1 - public/scripts/extensions/tts/coqui.js | 4 ++-- public/scripts/power-user.js | 24 +++++++++++++----------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 6aa30b437..1da6a6754 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -52,7 +52,6 @@ module.exports = { rules: { 'no-unused-vars': 'off', 'no-control-regex': 'off', - 'no-redeclare': 'off', 'no-async-promise-executor': 'off', 'no-inner-declarations': 'off', 'no-undef': 'off', diff --git a/public/scripts/extensions/tts/coqui.js b/public/scripts/extensions/tts/coqui.js index c287da7ca..3afe09001 100644 --- a/public/scripts/extensions/tts/coqui.js +++ b/public/scripts/extensions/tts/coqui.js @@ -495,7 +495,7 @@ class CoquiTtsProvider { .append('') .val('none'); - for (var i = 0; i < model_settings["languages"].length; i++) { + for (let i = 0; i < model_settings["languages"].length; i++) { const language_label = JSON.stringify(model_settings["languages"][i]).replaceAll("\"", ""); $("#coqui_api_model_settings_language").append(new Option(language_label, i)); } @@ -514,7 +514,7 @@ class CoquiTtsProvider { .append('') .val('none'); - for (var i = 0; i < model_settings["speakers"].length; i++) { + for (let i = 0; i < model_settings["speakers"].length; i++) { const speaker_label = JSON.stringify(model_settings["speakers"][i]).replaceAll("\"", ""); $("#coqui_api_model_settings_speaker").append(new Option(speaker_label, i)); } diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 1c896786f..7ae370d48 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -536,9 +536,10 @@ async function CreateZenSliders(elmnt) { var decimals = 2 var offVal, allVal var stepScale + var steps if (sliderID == 'amount_gen') { decimals = 0 - var steps = [16, 50, 100, 150, 200, 256, 300, 400, 512, 1024]; + steps = [16, 50, 100, 150, 200, 256, 300, 400, 512, 1024]; sliderMin = 0 sliderMax = steps.length - 1 stepScale = 1; @@ -548,11 +549,11 @@ async function CreateZenSliders(elmnt) { } if (sliderID == 'rep_pen_range_textgenerationwebui') { if (power_user.max_context_unlocked) { - var steps = [0, 256, 512, 768, 1024, 2048, 4096, 8192, 16355, 24576, 32768, 49152, 65536, -1]; + steps = [0, 256, 512, 768, 1024, 2048, 4096, 8192, 16355, 24576, 32768, 49152, 65536, -1]; numSteps = 13 allVal = 13 } else { - var steps = [0, 256, 512, 768, 1024, 2048, 4096, 8192, -1]; + steps = [0, 256, 512, 768, 1024, 2048, 4096, 8192, -1]; numSteps = 8 allVal = 8 } @@ -667,13 +668,14 @@ async function CreateZenSliders(elmnt) { max: sliderMax, create: function () { var handle = $(this).find(".ui-slider-handle"); + var handleText, stepNumber, leftMargin; //handling creation of amt_gen if (newSlider.attr('id') == 'amount_gen_zenslider') { //console.log(`using custom process for ${newSlider.attr('id')}`) - var handleText = steps[sliderValue] - var stepNumber = sliderValue - var leftMargin = ((stepNumber) / numSteps) * 50 * -1 + handleText = steps[sliderValue] + stepNumber = sliderValue + leftMargin = ((stepNumber) / numSteps) * 50 * -1 handle.text(handleText) .css('margin-left', `${leftMargin}px`) //console.log(`${newSlider.attr('id')} initial value:${handleText}, stepNum:${stepNumber}, numSteps:${numSteps}, left-margin:${leftMargin}`) @@ -683,9 +685,9 @@ async function CreateZenSliders(elmnt) { if ($('#rep_pen_range_textgenerationwebui_zensliders').length !== 0) { $('#rep_pen_range_textgenerationwebui_zensliders').remove() } - var handleText = steps[sliderValue] - var stepNumber = sliderValue - var leftMargin = ((stepNumber) / numSteps) * 50 * -1 + handleText = steps[sliderValue] + stepNumber = sliderValue + leftMargin = ((stepNumber) / numSteps) * 50 * -1 if (sliderValue === offVal) { handleText = 'Off' @@ -710,8 +712,8 @@ async function CreateZenSliders(elmnt) { } else { handle.text(numVal).css('color', ''); } - var stepNumber = ((sliderValue - sliderMin) / stepScale) - var leftMargin = (stepNumber / numSteps) * 50 * -1 + stepNumber = ((sliderValue - sliderMin) / stepScale) + leftMargin = (stepNumber / numSteps) * 50 * -1 var isManualInput = false var valueBeforeManualInput handle.css('margin-left', `${leftMargin}px`)