From 5f1bed1e7012d3182f8d3af1bf23223ad64cac06 Mon Sep 17 00:00:00 2001 From: valadaptive Date: Mon, 4 Dec 2023 12:32:41 -0500 Subject: [PATCH] Enable object-curly-spacing lint --- .eslintrc.js | 1 + public/script.js | 28 ++++++++++---------- public/scripts/bulk-edit.js | 2 +- public/scripts/extensions/translate/index.js | 2 +- public/scripts/extensions/tts/index.js | 2 +- public/scripts/extensions/tts/novel.js | 2 +- public/scripts/power-user.js | 8 +++--- 7 files changed, 23 insertions(+), 22 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index faafd14c6..a7d0800a7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -58,6 +58,7 @@ module.exports = { 'comma-dangle': ['error', 'always-multiline'], 'eol-last': ['error', 'always'], 'no-trailing-spaces': 'error', + 'object-curly-spacing': ['error', 'always'], // These rules should eventually be enabled. 'no-async-promise-executor': 'off', diff --git a/public/script.js b/public/script.js index 713300982..5cc778d9a 100644 --- a/public/script.js +++ b/public/script.js @@ -4157,7 +4157,7 @@ async function DupeChar() { const confirm = await callPopup(`

Are you sure you want to duplicate this character?

If you just want to start a new chat with the same character, use "Start new chat" option in the bottom-left options menu.

`, - 'confirm', + 'confirm', ); if (!confirm) { @@ -7635,22 +7635,22 @@ function addDebugFunctions() { `Recalculates token counts of all messages in the current chat to refresh the counters. Useful when you switch between models that have different tokenizers. This is a visual change only. Your chat will be reloaded.`, async () => { - for (const message of chat) { + for (const message of chat) { // System messages are not counted - if (message.is_system) { - continue; + if (message.is_system) { + continue; + } + + if (!message.extra) { + message.extra = {}; + } + + message.extra.token_count = getTokenCount(message.mes, 0); } - if (!message.extra) { - message.extra = {}; - } - - message.extra.token_count = getTokenCount(message.mes, 0); - } - - await saveChatConditional(); - await reloadCurrentChat(); - }); + await saveChatConditional(); + await reloadCurrentChat(); + }); registerDebugFunction('generationTest', 'Send a generation request', 'Generates text using the currently selected API.', async () => { const text = prompt('Input text:', 'Hello'); diff --git a/public/scripts/bulk-edit.js b/public/scripts/bulk-edit.js index 59124ff2b..7cb0d17b9 100644 --- a/public/scripts/bulk-edit.js +++ b/public/scripts/bulk-edit.js @@ -1,5 +1,5 @@ import { characters, getCharacters, handleDeleteCharacter, callPopup } from '../script.js'; -import {BulkEditOverlay, BulkEditOverlayState} from './BulkEditOverlay.js'; +import { BulkEditOverlay, BulkEditOverlayState } from './BulkEditOverlay.js'; let is_bulk_edit = false; diff --git a/public/scripts/extensions/translate/index.js b/public/scripts/extensions/translate/index.js index efd2ff5e0..d8e14b3d7 100644 --- a/public/scripts/extensions/translate/index.js +++ b/public/scripts/extensions/translate/index.js @@ -1,4 +1,4 @@ -export {translate}; +export { translate }; import { callPopup, diff --git a/public/scripts/extensions/tts/index.js b/public/scripts/extensions/tts/index.js index 68561d3b7..9ae47750b 100644 --- a/public/scripts/extensions/tts/index.js +++ b/public/scripts/extensions/tts/index.js @@ -10,7 +10,7 @@ import { NovelTtsProvider } from './novel.js'; import { power_user } from '../../power-user.js'; import { registerSlashCommand } from '../../slash-commands.js'; import { OpenAITtsProvider } from './openai.js'; -import {XTTSTtsProvider} from './xtts.js'; +import { XTTSTtsProvider } from './xtts.js'; export { talkingAnimation }; const UPDATE_INTERVAL = 1000; diff --git a/public/scripts/extensions/tts/novel.js b/public/scripts/extensions/tts/novel.js index 48db4aee2..62a6dd9ad 100644 --- a/public/scripts/extensions/tts/novel.js +++ b/public/scripts/extensions/tts/novel.js @@ -125,7 +125,7 @@ class NovelTtsProvider { throw 'TTS Voice name not provided'; } - return { name: voiceName, voice_id: voiceName, lang: 'en-US', preview_url: false}; + return { name: voiceName, voice_id: voiceName, lang: 'en-US', preview_url: false }; } async generateTts(text, voiceId) { diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 8c9b9dbec..ad45ab7ce 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -666,7 +666,7 @@ async function CreateZenSliders(elmnt) { min: sliderMin, max: sliderMax, create: async function () { - await delay(100) + await delay(100); var handle = $(this).find('.ui-slider-handle'); var handleText, stepNumber, leftMargin; @@ -711,7 +711,7 @@ async function CreateZenSliders(elmnt) { stepNumber = ((sliderValue - sliderMin) / stepScale); leftMargin = (stepNumber / numSteps) * 50 * -1; originalSlider.val(numVal) - .data('newSlider', newSlider) + .data('newSlider', newSlider); //console.log(`${newSlider.attr('id')} sliderValue = ${sliderValue}, handleText:${handleText, numVal}, stepNum:${stepNumber}, numSteps:${numSteps}, left-margin:${leftMargin}`) var isManualInput = false; var valueBeforeManualInput; @@ -737,8 +737,8 @@ async function CreateZenSliders(elmnt) { isManualInput = true; //allow enter to trigger slider update if (e.key === 'Enter') { - e.preventDefault - handle.trigger('blur') + e.preventDefault; + handle.trigger('blur'); } }) //trigger slider changes when user clicks away