From a7a3badb8e395c1e499cdc99ec23a2e43df93506 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 19 Mar 2025 19:46:32 +0200 Subject: [PATCH 01/11] Add ESLint PR check action --- .github/workflows/pr-run-eslint.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/pr-run-eslint.yml diff --git a/.github/workflows/pr-run-eslint.yml b/.github/workflows/pr-run-eslint.yml new file mode 100644 index 000000000..3387b5fd1 --- /dev/null +++ b/.github/workflows/pr-run-eslint.yml @@ -0,0 +1,22 @@ +name: ✅ Check ESLint on PR + +on: pull_request + +jobs: + eslint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm ci + - uses: sibiraj-s/action-eslint@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + eslint-args: '--ignore-path=.gitignore --quiet' + extensions: 'js,ts' + annotations: true + ignore-patterns: | + dist/ + lib/ From 8a4a338455619f52a40c9e723063e56ef785164f Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 19 Mar 2025 19:51:29 +0200 Subject: [PATCH 02/11] Add unlinted file --- src/test.js | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/test.js diff --git a/src/test.js b/src/test.js new file mode 100644 index 000000000..354dc9608 --- /dev/null +++ b/src/test.js @@ -0,0 +1,4 @@ +const test={ +"FOO":"BAR" +} + From 20cdcc37fce4959f81f678ead83949683f7c217f Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 19 Mar 2025 20:00:33 +0200 Subject: [PATCH 03/11] Fix fixable lints --- public/script.js | 2 +- public/scripts/bookmarks.js | 3 +-- public/scripts/extensions/stable-diffusion/index.js | 7 +++---- public/scripts/extensions/token-counter/index.js | 2 +- public/scripts/extensions/tts/index.js | 2 +- public/scripts/group-chats.js | 1 - public/scripts/slash-commands.js | 2 +- public/scripts/world-info.js | 2 +- src/test.js | 4 ---- 9 files changed, 9 insertions(+), 16 deletions(-) delete mode 100644 src/test.js diff --git a/public/script.js b/public/script.js index f53965eb3..0752d5600 100644 --- a/public/script.js +++ b/public/script.js @@ -595,7 +595,7 @@ let is_delete_mode = false; let fav_ch_checked = false; let scrollLock = false; export let abortStatusCheck = new AbortController(); -let charDragDropHandler = null; +export let charDragDropHandler = null; /** @type {debounce_timeout} The debounce timeout used for chat/settings save. debounce_timeout.long: 1.000 ms */ export const DEFAULT_SAVE_EDIT_TIMEOUT = debounce_timeout.relaxed; diff --git a/public/scripts/bookmarks.js b/public/scripts/bookmarks.js index 95a6a2517..719f6999a 100644 --- a/public/scripts/bookmarks.js +++ b/public/scripts/bookmarks.js @@ -1,7 +1,6 @@ import { characters, saveChat, - system_messages, system_message_types, this_chid, openCharacterChat, @@ -13,7 +12,7 @@ import { saveChatConditional, saveItemizedPrompts, } from '../script.js'; -import { humanizedDateTime, getMessageTimeStamp } from './RossAscends-mods.js'; +import { humanizedDateTime } from './RossAscends-mods.js'; import { getGroupPastChats, group_activation_strategy, diff --git a/public/scripts/extensions/stable-diffusion/index.js b/public/scripts/extensions/stable-diffusion/index.js index dfae3f1c5..923ee526b 100644 --- a/public/scripts/extensions/stable-diffusion/index.js +++ b/public/scripts/extensions/stable-diffusion/index.js @@ -2337,10 +2337,10 @@ function processReply(str) { str = str.replaceAll('“', ''); str = str.replaceAll('\n', ', '); str = str.normalize('NFD'); - + // Strip out non-alphanumeric characters barring model syntax exceptions str = str.replace(/[^a-zA-Z0-9.,:_(){}<>[\]\-'|#]+/g, ' '); - + str = str.replace(/\s+/g, ' '); // Collapse multiple whitespaces into one str = str.trim(); @@ -3234,7 +3234,7 @@ function getNovelParams() { extension_settings.sd.scheduler = 'karras'; } - if (extension_settings.sd.sampler === 'ddim' || + if (extension_settings.sd.sampler === 'ddim' || ['nai-diffusion-4-curated-preview', 'nai-diffusion-4-full'].includes(extension_settings.sd.model)) { sm = false; sm_dyn = false; @@ -3772,7 +3772,6 @@ async function addSDGenButtons() { $('#sd_wand_container').append(buttonHtml); $(document.body).append(dropdownHtml); - const messageButton = $('.sd_message_gen'); const button = $('#sd_gen'); const dropdown = $('#sd_dropdown'); dropdown.hide(); diff --git a/public/scripts/extensions/token-counter/index.js b/public/scripts/extensions/token-counter/index.js index 277019f40..f58212e1f 100644 --- a/public/scripts/extensions/token-counter/index.js +++ b/public/scripts/extensions/token-counter/index.js @@ -24,7 +24,7 @@ $('button').click(function () { async function doTokenCounter() { const { tokenizerName, tokenizerId } = getFriendlyTokenizerName(main_api); - const html = await renderExtensionTemplateAsync('token-counter', 'window', {tokenizerName}); + const html = await renderExtensionTemplateAsync('token-counter', 'window', { tokenizerName }); const dialog = $(html); const countDebounced = debounce(async () => { diff --git a/public/scripts/extensions/tts/index.js b/public/scripts/extensions/tts/index.js index 9f3b38727..a3067bd37 100644 --- a/public/scripts/extensions/tts/index.js +++ b/public/scripts/extensions/tts/index.js @@ -1,5 +1,5 @@ import { cancelTtsPlay, eventSource, event_types, getCurrentChatId, isStreamingEnabled, name2, saveSettingsDebounced, substituteParams } from '../../../script.js'; -import { ModuleWorkerWrapper, doExtrasFetch, extension_settings, getApiUrl, getContext, modules, renderExtensionTemplateAsync } from '../../extensions.js'; +import { ModuleWorkerWrapper, extension_settings, getContext, renderExtensionTemplateAsync } from '../../extensions.js'; import { delay, escapeRegex, getBase64Async, getStringHash, onlyUnique } from '../../utils.js'; import { EdgeTtsProvider } from './edge.js'; import { ElevenLabsTtsProvider } from './elevenlabs.js'; diff --git a/public/scripts/group-chats.js b/public/scripts/group-chats.js index e068baf76..337f3c247 100644 --- a/public/scripts/group-chats.js +++ b/public/scripts/group-chats.js @@ -46,7 +46,6 @@ import { hideSwipeButtons, chat_metadata, updateChatMetadata, - isStreamingEnabled, getThumbnailUrl, getRequestHeaders, setMenuType, diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index e1f8f0870..279c06c04 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -69,7 +69,7 @@ import { SlashCommand } from './slash-commands/SlashCommand.js'; import { SlashCommandAbortController } from './slash-commands/SlashCommandAbortController.js'; import { SlashCommandNamedArgumentAssignment } from './slash-commands/SlashCommandNamedArgumentAssignment.js'; import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js'; -import { POPUP_RESULT, POPUP_TYPE, Popup, callGenericPopup } from './popup.js'; +import { POPUP_TYPE, Popup, callGenericPopup } from './popup.js'; import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js'; import { SlashCommandBreakController } from './slash-commands/SlashCommandBreakController.js'; import { SlashCommandExecutionError } from './slash-commands/SlashCommandExecutionError.js'; diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index bda24ed32..88d02ce6c 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -1,6 +1,6 @@ import { Fuse } from '../lib.js'; -import { saveSettings, callPopup, substituteParams, getRequestHeaders, chat_metadata, this_chid, characters, saveCharacterDebounced, menu_type, eventSource, event_types, getExtensionPromptByName, saveMetadata, getCurrentChatId, extension_prompt_roles } from '../script.js'; +import { saveSettings, substituteParams, getRequestHeaders, chat_metadata, this_chid, characters, saveCharacterDebounced, menu_type, eventSource, event_types, getExtensionPromptByName, saveMetadata, getCurrentChatId, extension_prompt_roles } from '../script.js'; import { download, debounce, initScrollHeight, resetScrollHeight, parseJsonFile, extractDataFromPng, getFileBuffer, getCharaFilename, getSortableDelay, escapeRegex, PAGINATION_TEMPLATE, navigation_option, waitUntilCondition, isTrueBoolean, setValueByPath, flashHighlight, select2ModifyOptions, getSelect2OptionId, dynamicSelect2DataViaAjax, highlightRegex, select2ChoiceClickSubscribe, isFalseBoolean, getSanitizedFilename, checkOverwriteExistingData, getStringHash, parseStringArray, cancelDebounce, findChar, onlyUnique } from './utils.js'; import { extension_settings, getContext } from './extensions.js'; import { NOTE_MODULE_NAME, metadata_keys, shouldWIAddPrompt } from './authors-note.js'; diff --git a/src/test.js b/src/test.js deleted file mode 100644 index 354dc9608..000000000 --- a/src/test.js +++ /dev/null @@ -1,4 +0,0 @@ -const test={ -"FOO":"BAR" -} - From 39a385ab0491b4cf326028c9f8640d29cba985c5 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Wed, 19 Mar 2025 19:58:00 +0100 Subject: [PATCH 04/11] Update eslint workflows version + formatting - Add explicit version numbers (to prevent update conflicts) - Separate the steps and give them names, for better readability on workflow log - Only run on opened/synchronize --- .github/workflows/pr-run-eslint.yml | 33 +++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-run-eslint.yml b/.github/workflows/pr-run-eslint.yml index 3387b5fd1..4e30608c9 100644 --- a/.github/workflows/pr-run-eslint.yml +++ b/.github/workflows/pr-run-eslint.yml @@ -1,17 +1,38 @@ name: ✅ Check ESLint on PR -on: pull_request +on: + pull_request: # TODO: change to pull_request_target for 'staging' + types: [opened, synchronize] + +permissions: + contents: read + pull-requests: write jobs: - eslint: + run-eslint: + name: ✅ Check ESLint on PR runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - name: Checkout Repository + # Checkout + # https://github.com/marketplace/actions/checkout + uses: actions/checkout@v4.2.2 + + - name: Setup Node.js + # Setup Node.js environment + # https://github.com/marketplace/actions/setup-node-js-environment + uses: actions/setup-node@v4.3.0 with: node-version: 20 - - run: npm ci - - uses: sibiraj-s/action-eslint@v3 + + - name: Run npm install + run: npm ci + + - name: Run ESLint + # Action ESLint + # https://github.com/marketplace/actions/action-eslint + uses: sibiraj-s/action-eslint@v3.0.1 with: token: ${{ secrets.GITHUB_TOKEN }} eslint-args: '--ignore-path=.gitignore --quiet' From b88f9fb1ffa70f60baec7e639b1c338973ea52c6 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Wed, 19 Mar 2025 19:59:17 +0100 Subject: [PATCH 05/11] break some linting --- public/scripts/slash-commands.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index 279c06c04..e1f8f0870 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -69,7 +69,7 @@ import { SlashCommand } from './slash-commands/SlashCommand.js'; import { SlashCommandAbortController } from './slash-commands/SlashCommandAbortController.js'; import { SlashCommandNamedArgumentAssignment } from './slash-commands/SlashCommandNamedArgumentAssignment.js'; import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js'; -import { POPUP_TYPE, Popup, callGenericPopup } from './popup.js'; +import { POPUP_RESULT, POPUP_TYPE, Popup, callGenericPopup } from './popup.js'; import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js'; import { SlashCommandBreakController } from './slash-commands/SlashCommandBreakController.js'; import { SlashCommandExecutionError } from './slash-commands/SlashCommandExecutionError.js'; From 73520b923fdcb45650c2e7c77929822ad2e40af2 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Wed, 19 Mar 2025 20:01:31 +0100 Subject: [PATCH 06/11] break some linting... --- public/scripts/reasoning.js | 2 +- public/scripts/slash-commands.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/scripts/reasoning.js b/public/scripts/reasoning.js index b63b26f63..af5f66833 100644 --- a/public/scripts/reasoning.js +++ b/public/scripts/reasoning.js @@ -6,7 +6,7 @@ import { getRegexedString, regex_placement } from './extensions/regex/engine.js' import { getCurrentLocale, t, translate } from './i18n.js'; import { MacrosParser } from './macros.js'; import { chat_completion_sources, getChatCompletionModel, oai_settings } from './openai.js'; -import { Popup } from './popup.js'; +import { POPUP_RESULT, Popup } from './popup.js'; import { performFuzzySearch, power_user } from './power-user.js'; import { getPresetManager } from './preset-manager.js'; import { SlashCommand } from './slash-commands/SlashCommand.js'; diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index e1f8f0870..279c06c04 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -69,7 +69,7 @@ import { SlashCommand } from './slash-commands/SlashCommand.js'; import { SlashCommandAbortController } from './slash-commands/SlashCommandAbortController.js'; import { SlashCommandNamedArgumentAssignment } from './slash-commands/SlashCommandNamedArgumentAssignment.js'; import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js'; -import { POPUP_RESULT, POPUP_TYPE, Popup, callGenericPopup } from './popup.js'; +import { POPUP_TYPE, Popup, callGenericPopup } from './popup.js'; import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js'; import { SlashCommandBreakController } from './slash-commands/SlashCommandBreakController.js'; import { SlashCommandExecutionError } from './slash-commands/SlashCommandExecutionError.js'; From 0af4a3ebd7c879c503e86eeec096dbf6c9d0e59e Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 19 Mar 2025 21:10:34 +0200 Subject: [PATCH 07/11] Fix unfixable lints --- .eslintrc.cjs | 4 + package-lock.json | 238 +++++++++++++++++- package.json | 3 +- public/scripts/autocomplete/AutoComplete.js | 2 - .../AutoCompleteNameResultBase.js | 1 - .../autocomplete/AutoCompleteOption.js | 21 +- .../quick-reply/api/QuickReplyApi.js | 9 +- .../quick-reply/src/AutoExecuteHandler.js | 10 +- .../extensions/quick-reply/src/QuickReply.js | 4 +- .../quick-reply/src/SlashCommandHandler.js | 7 +- .../extensions/quick-reply/src/ui/ButtonUi.js | 3 +- .../quick-reply/src/ui/SettingsUi.js | 7 +- .../quick-reply/src/ui/ctx/ContextMenu.js | 1 - .../scripts/extensions/tts/gpt-sovits-v2.js | 2 - public/scripts/nai-settings.js | 1 + public/scripts/slash-commands/SlashCommand.js | 8 +- .../SlashCommandAutoCompleteNameResult.js | 3 - .../slash-commands/SlashCommandClosure.js | 29 +-- .../SlashCommandDebugController.js | 22 +- .../slash-commands/SlashCommandEnumValue.js | 4 - .../slash-commands/SlashCommandExecutor.js | 13 +- .../SlashCommandNamedArgumentAssignment.js | 8 +- ...hCommandNamedArgumentAutoCompleteOption.js | 5 +- .../slash-commands/SlashCommandParser.js | 43 ++-- .../slash-commands/SlashCommandScope.js | 12 +- .../SlashCommandUnnamedArgumentAssignment.js | 6 +- public/scripts/tags.js | 1 - public/scripts/variables.js | 4 +- 28 files changed, 336 insertions(+), 135 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index cbf52f217..4703190b9 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -3,6 +3,9 @@ module.exports = { extends: [ 'eslint:recommended', ], + plugins: [ + 'jsdoc', + ], env: { es6: true, }, @@ -78,6 +81,7 @@ module.exports = { 'public/scripts/extensions/tts/lib/**', ], rules: { + 'jsdoc/no-undefined-types': ['warn', { disableReporting: true, markVariablesAsUsed: true }], 'no-unused-vars': ['error', { args: 'none' }], 'no-control-regex': 'off', 'no-constant-condition': ['error', { checkLoops: false }], diff --git a/package-lock.json b/package-lock.json index 3c3f67dd2..99b56ae79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -110,7 +110,8 @@ "@types/write-file-atomic": "^4.0.3", "@types/yargs": "^17.0.33", "@types/yauzl": "^2.10.3", - "eslint": "^8.57.1" + "eslint": "^8.57.1", + "eslint-plugin-jsdoc": "^50.6.8" }, "engines": { "node": ">= 18" @@ -147,6 +148,21 @@ "integrity": "sha512-KlmTftToTtmb6aLVdne4NluS+POWputPF5J8v25UN/EQS+K9vahWEIe1NPRSFqBQclObkqHaj7JOnFrmnSm5MA==", "license": "Apache-2.0" }, + "node_modules/@es-joy/jsdoccomment": { + "version": "0.49.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.49.0.tgz", + "integrity": "sha512-xjZTSFgECpb9Ohuk5yMX5RhUEbfeQcuOp8IF60e+wyzWEF0M5xeSgqsfLtvPEX8BIyOX9saZqzuGPmZ8oWc+5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "comment-parser": "1.4.1", + "esquery": "^1.6.0", + "jsdoc-type-pratt-parser": "~4.1.0" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -970,6 +986,19 @@ "node": ">=14" } }, + "node_modules/@pkgr/core": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, "node_modules/@popperjs/core": { "version": "2.11.8", "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", @@ -2099,6 +2128,16 @@ "safe-buffer": "~5.2.0" } }, + "node_modules/are-docs-informative": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/are-docs-informative/-/are-docs-informative-0.0.2.tgz", + "integrity": "sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + } + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -2614,6 +2653,16 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "license": "MIT" }, + "node_modules/comment-parser": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.1.tgz", + "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12.0.0" + } + }, "node_modules/compress-commons": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.2.tgz", @@ -3560,6 +3609,101 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-plugin-jsdoc": { + "version": "50.6.8", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-50.6.8.tgz", + "integrity": "sha512-PPZVqhoXaalMQwDGzcQrJtPSPIPOYsSMtvkjYAdsIazOW20yhYtVX4+jLL+XznD4zYTXyZbPWPRKkNev4D4lyw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@es-joy/jsdoccomment": "~0.49.0", + "are-docs-informative": "^0.0.2", + "comment-parser": "1.4.1", + "debug": "^4.3.6", + "escape-string-regexp": "^4.0.0", + "espree": "^10.1.0", + "esquery": "^1.6.0", + "parse-imports": "^2.1.1", + "semver": "^7.6.3", + "spdx-expression-parse": "^4.0.0", + "synckit": "^0.9.1" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0" + } + }, + "node_modules/eslint-plugin-jsdoc/node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-jsdoc/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint-plugin-jsdoc/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-plugin-jsdoc/node_modules/espree": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.14.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-plugin-jsdoc/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", @@ -3690,9 +3834,9 @@ } }, "node_modules/esquery": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", - "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -5015,6 +5159,16 @@ "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", "license": "MIT" }, + "node_modules/jsdoc-type-pratt-parser": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.1.0.tgz", + "integrity": "sha512-Hicd6JK5Njt2QB6XYFS7ok9e37O8AYk3jTcppG4YVQnYjOemymvTcmc7OWsmq/Qqj5TdRFO5/x/tIPmBeRtGHg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", @@ -5891,6 +6045,20 @@ "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==", "license": "MIT" }, + "node_modules/parse-imports": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/parse-imports/-/parse-imports-2.2.1.tgz", + "integrity": "sha512-OL/zLggRp8mFhKL0rNORUTR4yBYujK/uU+xZL+/0Rgm2QE4nLO9v8PzEweSJEbMGKmDRjJE4R3IMJlL2di4JeQ==", + "dev": true, + "license": "Apache-2.0 AND MIT", + "dependencies": { + "es-module-lexer": "^1.5.3", + "slashes": "^3.0.12" + }, + "engines": { + "node": ">= 18" + } + }, "node_modules/parse5": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", @@ -6600,6 +6768,19 @@ "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==", "license": "MIT" }, + "node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/send": { "version": "0.19.0", "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", @@ -6811,6 +6992,13 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, + "node_modules/slashes": { + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/slashes/-/slashes-3.0.12.tgz", + "integrity": "sha512-Q9VME8WyGkc7pJf6QEkj3wE+2CnvZMI+XJhwdTPR8Z/kWQRXi7boAWLDibRPyHRTUTPx5FaU7MsyrjI3yLB4HA==", + "dev": true, + "license": "ISC" + }, "node_modules/sliced": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", @@ -6903,6 +7091,31 @@ "source-map": "^0.6.0" } }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true, + "license": "CC-BY-3.0" + }, + "node_modules/spdx-expression-parse": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-4.0.0.tgz", + "integrity": "sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.21", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.21.tgz", + "integrity": "sha512-Bvg/8F5XephndSK3JffaRqdT+gyhfqIPwDHpX80tJrF8QQRYMo8sNMeaZ2Dp5+jhwKnUmIOyFFQfHRkjJm5nXg==", + "dev": true, + "license": "CC0-1.0" + }, "node_modules/sprintf-js": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", @@ -7042,6 +7255,23 @@ "node": ">=8" } }, + "node_modules/synckit": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.2.tgz", + "integrity": "sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, "node_modules/tapable": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", diff --git a/package.json b/package.json index c9d969d49..cfd53c7de 100644 --- a/package.json +++ b/package.json @@ -140,6 +140,7 @@ "@types/write-file-atomic": "^4.0.3", "@types/yargs": "^17.0.33", "@types/yauzl": "^2.10.3", - "eslint": "^8.57.1" + "eslint": "^8.57.1", + "eslint-plugin-jsdoc": "^50.6.8" } } diff --git a/public/scripts/autocomplete/AutoComplete.js b/public/scripts/autocomplete/AutoComplete.js index ba3d427a2..be60e4bb6 100644 --- a/public/scripts/autocomplete/AutoComplete.js +++ b/public/scripts/autocomplete/AutoComplete.js @@ -3,10 +3,8 @@ import { debounce, escapeRegex } from '../utils.js'; import { AutoCompleteOption } from './AutoCompleteOption.js'; import { AutoCompleteFuzzyScore } from './AutoCompleteFuzzyScore.js'; import { BlankAutoCompleteOption } from './BlankAutoCompleteOption.js'; -// eslint-disable-next-line no-unused-vars import { AutoCompleteNameResult } from './AutoCompleteNameResult.js'; import { AutoCompleteSecondaryNameResult } from './AutoCompleteSecondaryNameResult.js'; -import { Popup, getTopmostModalLayer } from '../popup.js'; /**@readonly*/ /**@enum {Number}*/ diff --git a/public/scripts/autocomplete/AutoCompleteNameResultBase.js b/public/scripts/autocomplete/AutoCompleteNameResultBase.js index 150ee68c5..4494a28f3 100644 --- a/public/scripts/autocomplete/AutoCompleteNameResultBase.js +++ b/public/scripts/autocomplete/AutoCompleteNameResultBase.js @@ -1,4 +1,3 @@ -import { SlashCommandNamedArgumentAutoCompleteOption } from '../slash-commands/SlashCommandNamedArgumentAutoCompleteOption.js'; import { AutoCompleteOption } from './AutoCompleteOption.js'; diff --git a/public/scripts/autocomplete/AutoCompleteOption.js b/public/scripts/autocomplete/AutoCompleteOption.js index 24822750b..f835a1101 100644 --- a/public/scripts/autocomplete/AutoCompleteOption.js +++ b/public/scripts/autocomplete/AutoCompleteOption.js @@ -1,19 +1,18 @@ -import { SlashCommand } from '../slash-commands/SlashCommand.js'; import { AutoCompleteFuzzyScore } from './AutoCompleteFuzzyScore.js'; export class AutoCompleteOption { - /**@type {string}*/ name; - /**@type {string}*/ typeIcon; - /**@type {string}*/ type; - /**@type {number}*/ nameOffset = 0; - /**@type {AutoCompleteFuzzyScore}*/ score; - /**@type {string}*/ replacer; - /**@type {HTMLElement}*/ dom; - /**@type {(input:string)=>boolean}*/ matchProvider; - /**@type {(input:string)=>string}*/ valueProvider; - /**@type {boolean}*/ makeSelectable = false; + /** @type {string} */ name; + /** @type {string} */ typeIcon; + /** @type {string} */ type; + /** @type {number} */ nameOffset = 0; + /** @type {AutoCompleteFuzzyScore} */ score; + /** @type {string} */ replacer; + /** @type {HTMLElement} */ dom; + /** @type {(input:string)=>boolean} */ matchProvider; + /** @type {(input:string)=>string} */ valueProvider; + /** @type {boolean} */ makeSelectable = false; /** diff --git a/public/scripts/extensions/quick-reply/api/QuickReplyApi.js b/public/scripts/extensions/quick-reply/api/QuickReplyApi.js index 59c258620..6565ff3bb 100644 --- a/public/scripts/extensions/quick-reply/api/QuickReplyApi.js +++ b/public/scripts/extensions/quick-reply/api/QuickReplyApi.js @@ -1,21 +1,18 @@ -// eslint-disable-next-line no-unused-vars import { QuickReply } from '../src/QuickReply.js'; import { QuickReplyContextLink } from '../src/QuickReplyContextLink.js'; import { QuickReplySet } from '../src/QuickReplySet.js'; -// eslint-disable-next-line no-unused-vars import { QuickReplySettings } from '../src/QuickReplySettings.js'; -// eslint-disable-next-line no-unused-vars import { SettingsUi } from '../src/ui/SettingsUi.js'; import { onlyUnique } from '../../../utils.js'; export class QuickReplyApi { - /**@type {QuickReplySettings}*/ settings; - /**@type {SettingsUi}*/ settingsUi; + /** @type {QuickReplySettings} */ settings; + /** @type {SettingsUi} */ settingsUi; - constructor(/**@type {QuickReplySettings}*/settings, /**@type {SettingsUi}*/settingsUi) { + constructor(/** @type {QuickReplySettings} */settings, /** @type {SettingsUi} */settingsUi) { this.settings = settings; this.settingsUi = settingsUi; } diff --git a/public/scripts/extensions/quick-reply/src/AutoExecuteHandler.js b/public/scripts/extensions/quick-reply/src/AutoExecuteHandler.js index 1b9174bba..91a8b75cf 100644 --- a/public/scripts/extensions/quick-reply/src/AutoExecuteHandler.js +++ b/public/scripts/extensions/quick-reply/src/AutoExecuteHandler.js @@ -1,18 +1,16 @@ import { warn } from '../index.js'; -// eslint-disable-next-line no-unused-vars import { QuickReply } from './QuickReply.js'; -// eslint-disable-next-line no-unused-vars import { QuickReplySettings } from './QuickReplySettings.js'; export class AutoExecuteHandler { - /**@type {QuickReplySettings}*/ settings; + /** @type {QuickReplySettings} */ settings; - /**@type {Boolean[]}*/ preventAutoExecuteStack = []; + /** @type {Boolean[]}*/ preventAutoExecuteStack = []; - constructor(/**@type {QuickReplySettings}*/settings) { + constructor(/** @type {QuickReplySettings} */settings) { this.settings = settings; } @@ -24,7 +22,7 @@ export class AutoExecuteHandler { - async performAutoExecute(/**@type {QuickReply[]}*/qrList) { + async performAutoExecute(/** @type {QuickReply[]} */qrList) { for (const qr of qrList) { this.preventAutoExecuteStack.push(qr.preventAutoExecute); try { diff --git a/public/scripts/extensions/quick-reply/src/QuickReply.js b/public/scripts/extensions/quick-reply/src/QuickReply.js index d1e0ac012..4647ae8a3 100644 --- a/public/scripts/extensions/quick-reply/src/QuickReply.js +++ b/public/scripts/extensions/quick-reply/src/QuickReply.js @@ -49,7 +49,7 @@ export class QuickReply { /**@type {string}*/ automationId = ''; /**@type {function}*/ onExecute; - /**@type {(qr:QuickReply)=>AsyncGenerator}*/ onDebug; + /** @type {(qr:QuickReply)=>AsyncGenerator} */ onDebug; /**@type {function}*/ onDelete; /**@type {function}*/ onUpdate; /**@type {function}*/ onInsertBefore; @@ -635,7 +635,6 @@ export class QuickReply { }, { passive:true }); const getLineStart = ()=>{ const start = message.selectionStart; - const end = message.selectionEnd; let lineStart; if (start == 0 || message.value[start - 1] == '\n') { // cursor is already at beginning of line @@ -701,7 +700,6 @@ export class QuickReply { } else if (evt.key == 'Enter' && !evt.ctrlKey && !evt.shiftKey && !evt.altKey && !(ac.isReplaceable && ac.isActive)) { // new line, keep indent const start = message.selectionStart; - const end = message.selectionEnd; let lineStart = getLineStart(); const indent = /^([^\S\n]*)/.exec(message.value.slice(lineStart))[1] ?? ''; if (indent.length) { diff --git a/public/scripts/extensions/quick-reply/src/SlashCommandHandler.js b/public/scripts/extensions/quick-reply/src/SlashCommandHandler.js index b131e9668..1c14dcbd2 100644 --- a/public/scripts/extensions/quick-reply/src/SlashCommandHandler.js +++ b/public/scripts/extensions/quick-reply/src/SlashCommandHandler.js @@ -8,18 +8,17 @@ import { SlashCommandEnumValue, enumTypes } from '../../../slash-commands/SlashC import { SlashCommandParser } from '../../../slash-commands/SlashCommandParser.js'; import { SlashCommandScope } from '../../../slash-commands/SlashCommandScope.js'; import { isTrueBoolean } from '../../../utils.js'; -// eslint-disable-next-line no-unused-vars import { QuickReplyApi } from '../api/QuickReplyApi.js'; import { QuickReply } from './QuickReply.js'; import { QuickReplySet } from './QuickReplySet.js'; export class SlashCommandHandler { - /**@type {QuickReplyApi}*/ api; + /** @type {QuickReplyApi} */ api; - constructor(/**@type {QuickReplyApi}*/api) { + constructor(/** @type {QuickReplyApi} */api) { this.api = api; } @@ -27,7 +26,7 @@ export class SlashCommandHandler { init() { - function getExecutionIcons(/**@type {QuickReply} */ qr) { + function getExecutionIcons(/** @type {QuickReply} */ qr) { let icons = ''; if (qr.preventAutoExecute) icons += '🚫'; if (qr.isHidden) icons += '👁️'; diff --git a/public/scripts/extensions/quick-reply/src/ui/ButtonUi.js b/public/scripts/extensions/quick-reply/src/ui/ButtonUi.js index 189489bab..54789a9f6 100644 --- a/public/scripts/extensions/quick-reply/src/ui/ButtonUi.js +++ b/public/scripts/extensions/quick-reply/src/ui/ButtonUi.js @@ -1,11 +1,10 @@ import { animation_duration } from '../../../../../script.js'; import { dragElement } from '../../../../RossAscends-mods.js'; import { loadMovingUIState } from '../../../../power-user.js'; -// eslint-disable-next-line no-unused-vars import { QuickReplySettings } from '../QuickReplySettings.js'; export class ButtonUi { - /**@type {QuickReplySettings}*/ settings; + /** @type {QuickReplySettings} */ settings; /**@type {HTMLElement}*/ dom; /**@type {HTMLElement}*/ popoutDom; diff --git a/public/scripts/extensions/quick-reply/src/ui/SettingsUi.js b/public/scripts/extensions/quick-reply/src/ui/SettingsUi.js index a4bff8d06..adb568aaf 100644 --- a/public/scripts/extensions/quick-reply/src/ui/SettingsUi.js +++ b/public/scripts/extensions/quick-reply/src/ui/SettingsUi.js @@ -3,14 +3,13 @@ import { getSortableDelay } from '../../../../utils.js'; import { log, warn } from '../../index.js'; import { QuickReply } from '../QuickReply.js'; import { QuickReplySet } from '../QuickReplySet.js'; -// eslint-disable-next-line no-unused-vars import { QuickReplySettings } from '../QuickReplySettings.js'; export class SettingsUi { - /**@type {QuickReplySettings}*/ settings; + /** @type {QuickReplySettings} */ settings; - /**@type {HTMLElement}*/ template; - /**@type {HTMLElement}*/ dom; + /** @type {HTMLElement} */ template; + /** @type {HTMLElement} */ dom; /**@type {HTMLInputElement}*/ isEnabled; /**@type {HTMLInputElement}*/ isCombined; diff --git a/public/scripts/extensions/quick-reply/src/ui/ctx/ContextMenu.js b/public/scripts/extensions/quick-reply/src/ui/ctx/ContextMenu.js index 9f712379b..020d5ba1e 100644 --- a/public/scripts/extensions/quick-reply/src/ui/ctx/ContextMenu.js +++ b/public/scripts/extensions/quick-reply/src/ui/ctx/ContextMenu.js @@ -1,5 +1,4 @@ import { QuickReply } from '../../QuickReply.js'; -// eslint-disable-next-line no-unused-vars import { QuickReplySet } from '../../QuickReplySet.js'; import { MenuHeader } from './MenuHeader.js'; import { MenuItem } from './MenuItem.js'; diff --git a/public/scripts/extensions/tts/gpt-sovits-v2.js b/public/scripts/extensions/tts/gpt-sovits-v2.js index b6d2f740d..390333bc2 100644 --- a/public/scripts/extensions/tts/gpt-sovits-v2.js +++ b/public/scripts/extensions/tts/gpt-sovits-v2.js @@ -183,8 +183,6 @@ class GptSovitsV2Provider { let prompt_text = replaceSpeaker(voiceId); - const streaming = this.settings.streaming; - const params = { text: inputText, prompt_text: prompt_text, diff --git a/public/scripts/nai-settings.js b/public/scripts/nai-settings.js index 91ff09ef6..e795f5230 100644 --- a/public/scripts/nai-settings.js +++ b/public/scripts/nai-settings.js @@ -795,6 +795,7 @@ export function parseNovelAILogprobs(data) { // Add the chosen token to `merged` if it's not already there. This can // happen if the chosen token was not among the top 10 most likely ones. + // eslint-disable-next-line no-unused-vars const [[chosenId], [_, chosenAfter]] = data.chosen[0]; if (!merged.some(([id]) => id === chosenId)) { merged.push([chosenId, chosenAfter]); diff --git a/public/scripts/slash-commands/SlashCommand.js b/public/scripts/slash-commands/SlashCommand.js index d784bfed3..ee1aafd49 100644 --- a/public/scripts/slash-commands/SlashCommand.js +++ b/public/scripts/slash-commands/SlashCommand.js @@ -3,16 +3,16 @@ import { SlashCommandAbortController } from './SlashCommandAbortController.js'; import { SlashCommandArgument, SlashCommandNamedArgument } from './SlashCommandArgument.js'; import { SlashCommandClosure } from './SlashCommandClosure.js'; import { SlashCommandDebugController } from './SlashCommandDebugController.js'; -import { PARSER_FLAG } from './SlashCommandParser.js'; import { SlashCommandScope } from './SlashCommandScope.js'; - - +/** + * @typedef {import('./SlashCommandParser.js').ParserFlags} ParserFlags + */ /** * @typedef {{ * _scope:SlashCommandScope, - * _parserFlags:{[id:PARSER_FLAG]:boolean}, + * _parserFlags:{ParserFlags}, * _abortController:SlashCommandAbortController, * _debugController:SlashCommandDebugController, * _hasUnnamedArgument:boolean, diff --git a/public/scripts/slash-commands/SlashCommandAutoCompleteNameResult.js b/public/scripts/slash-commands/SlashCommandAutoCompleteNameResult.js index e72a20e6a..bf236acbd 100644 --- a/public/scripts/slash-commands/SlashCommandAutoCompleteNameResult.js +++ b/public/scripts/slash-commands/SlashCommandAutoCompleteNameResult.js @@ -1,9 +1,6 @@ import { AutoCompleteNameResult } from '../autocomplete/AutoCompleteNameResult.js'; -import { AutoCompleteOption } from '../autocomplete/AutoCompleteOption.js'; import { AutoCompleteSecondaryNameResult } from '../autocomplete/AutoCompleteSecondaryNameResult.js'; import { SlashCommand } from './SlashCommand.js'; -import { SlashCommandNamedArgument } from './SlashCommandArgument.js'; -import { SlashCommandClosure } from './SlashCommandClosure.js'; import { SlashCommandCommandAutoCompleteOption } from './SlashCommandCommandAutoCompleteOption.js'; import { SlashCommandEnumAutoCompleteOption } from './SlashCommandEnumAutoCompleteOption.js'; import { SlashCommandExecutor } from './SlashCommandExecutor.js'; diff --git a/public/scripts/slash-commands/SlashCommandClosure.js b/public/scripts/slash-commands/SlashCommandClosure.js index 0ba1726b5..2cec39219 100644 --- a/public/scripts/slash-commands/SlashCommandClosure.js +++ b/public/scripts/slash-commands/SlashCommandClosure.js @@ -2,7 +2,6 @@ import { substituteParams } from '../../script.js'; import { delay, escapeRegex, uuidv4 } from '../utils.js'; import { SlashCommand } from './SlashCommand.js'; import { SlashCommandAbortController } from './SlashCommandAbortController.js'; -import { SlashCommandNamedArgument } from './SlashCommandArgument.js'; import { SlashCommandBreak } from './SlashCommandBreak.js'; import { SlashCommandBreakController } from './SlashCommandBreakController.js'; import { SlashCommandBreakPoint } from './SlashCommandBreakPoint.js'; @@ -14,21 +13,19 @@ import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgument import { SlashCommandScope } from './SlashCommandScope.js'; export class SlashCommandClosure { - /**@type {SlashCommandScope}*/ scope; - /**@type {boolean}*/ executeNow = false; - // @ts-ignore - /**@type {SlashCommandNamedArgumentAssignment[]}*/ argumentList = []; - // @ts-ignore - /**@type {SlashCommandNamedArgumentAssignment[]}*/ providedArgumentList = []; - /**@type {SlashCommandExecutor[]}*/ executorList = []; - /**@type {SlashCommandAbortController}*/ abortController; - /**@type {SlashCommandBreakController}*/ breakController; - /**@type {SlashCommandDebugController}*/ debugController; - /**@type {(done:number, total:number)=>void}*/ onProgress; - /**@type {string}*/ rawText; - /**@type {string}*/ fullText; - /**@type {string}*/ parserContext; - /**@type {string}*/ #source = uuidv4(); + /** @type {SlashCommandScope} */ scope; + /** @type {boolean} */ executeNow = false; + /** @type {SlashCommandNamedArgumentAssignment[]} */ argumentList = []; + /** @type {SlashCommandNamedArgumentAssignment[]} */ providedArgumentList = []; + /** @type {SlashCommandExecutor[]} */ executorList = []; + /** @type {SlashCommandAbortController} */ abortController; + /** @type {SlashCommandBreakController} */ breakController; + /** @type {SlashCommandDebugController} */ debugController; + /** @type {(done:number, total:number)=>void} */ onProgress; + /** @type {string} */ rawText; + /** @type {string} */ fullText; + /** @type {string} */ parserContext; + /** @type {string} */ #source = uuidv4(); get source() { return this.#source; } set source(value) { this.#source = value; diff --git a/public/scripts/slash-commands/SlashCommandDebugController.js b/public/scripts/slash-commands/SlashCommandDebugController.js index 16969746a..2d1eef1c2 100644 --- a/public/scripts/slash-commands/SlashCommandDebugController.js +++ b/public/scripts/slash-commands/SlashCommandDebugController.js @@ -2,20 +2,20 @@ import { SlashCommandClosure } from './SlashCommandClosure.js'; import { SlashCommandExecutor } from './SlashCommandExecutor.js'; export class SlashCommandDebugController { - /**@type {SlashCommandClosure[]} */ stack = []; - /**@type {SlashCommandExecutor[]} */ cmdStack = []; - /**@type {boolean[]} */ stepStack = []; - /**@type {boolean} */ isStepping = false; - /**@type {boolean} */ isSteppingInto = false; - /**@type {boolean} */ isSteppingOut = false; + /** @type {SlashCommandClosure[]} */ stack = []; + /** @type {SlashCommandExecutor[]} */ cmdStack = []; + /** @type {boolean[]} */ stepStack = []; + /** @type {boolean} */ isStepping = false; + /** @type {boolean} */ isSteppingInto = false; + /** @type {boolean} */ isSteppingOut = false; - /**@type {object} */ namedArguments; - /**@type {string|SlashCommandClosure|(string|SlashCommandClosure)[]} */ unnamedArguments; + /** @type {object} */ namedArguments; + /** @type {string|SlashCommandClosure|(string|SlashCommandClosure)[]} */ unnamedArguments; - /**@type {Promise} */ continuePromise; - /**@type {(boolean)=>void} */ continueResolver; + /** @type {Promise} */ continuePromise; + /** @type {(boolean)=>void} */ continueResolver; - /**@type {(closure:SlashCommandClosure, executor:SlashCommandExecutor)=>Promise} */ onBreakPoint; + /** @type {(closure:SlashCommandClosure, executor:SlashCommandExecutor)=>Promise} */ onBreakPoint; diff --git a/public/scripts/slash-commands/SlashCommandEnumValue.js b/public/scripts/slash-commands/SlashCommandEnumValue.js index 077af5e86..6978804c2 100644 --- a/public/scripts/slash-commands/SlashCommandEnumValue.js +++ b/public/scripts/slash-commands/SlashCommandEnumValue.js @@ -1,7 +1,3 @@ -import { SlashCommandExecutor } from './SlashCommandExecutor.js'; -import { SlashCommandScope } from './SlashCommandScope.js'; - - /** * @typedef {'enum' | 'command' | 'namedArgument' | 'variable' | 'qr' | 'macro' | 'number' | 'name'} EnumType */ diff --git a/public/scripts/slash-commands/SlashCommandExecutor.js b/public/scripts/slash-commands/SlashCommandExecutor.js index cfbcf6cf1..4ea64805d 100644 --- a/public/scripts/slash-commands/SlashCommandExecutor.js +++ b/public/scripts/slash-commands/SlashCommandExecutor.js @@ -1,11 +1,7 @@ -// eslint-disable-next-line no-unused-vars import { uuidv4 } from '../utils.js'; import { SlashCommand } from './SlashCommand.js'; -// eslint-disable-next-line no-unused-vars import { SlashCommandClosure } from './SlashCommandClosure.js'; import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js'; -// eslint-disable-next-line no-unused-vars -import { PARSER_FLAG } from './SlashCommandParser.js'; import { SlashCommandUnnamedArgumentAssignment } from './SlashCommandUnnamedArgumentAssignment.js'; export class SlashCommandExecutor { @@ -28,11 +24,10 @@ export class SlashCommandExecutor { arg.value.source = value; } } - /**@type {SlashCommand}*/ command; - // @ts-ignore - /**@type {SlashCommandNamedArgumentAssignment[]}*/ namedArgumentList = []; - /**@type {SlashCommandUnnamedArgumentAssignment[]}*/ unnamedArgumentList = []; - /**@type {{[id:PARSER_FLAG]:boolean}} */ parserFlags; + /** @type {SlashCommand} */ command; + /** @type {SlashCommandNamedArgumentAssignment[]} */ namedArgumentList = []; + /** @type {SlashCommandUnnamedArgumentAssignment[]} */ unnamedArgumentList = []; + /** @type {import('./SlashCommandParser.js').ParserFlags} */ parserFlags; get commandCount() { return 1 diff --git a/public/scripts/slash-commands/SlashCommandNamedArgumentAssignment.js b/public/scripts/slash-commands/SlashCommandNamedArgumentAssignment.js index 023144608..5c9cdfc7b 100644 --- a/public/scripts/slash-commands/SlashCommandNamedArgumentAssignment.js +++ b/public/scripts/slash-commands/SlashCommandNamedArgumentAssignment.js @@ -1,10 +1,10 @@ import { SlashCommandClosure } from './SlashCommandClosure.js'; export class SlashCommandNamedArgumentAssignment { - /**@type {number}*/ start; - /**@type {number}*/ end; - /**@type {string}*/ name; - /**@type {string|SlashCommandClosure}*/ value; + /** @type {number} */ start; + /** @type {number} */ end; + /** @type {string} */ name; + /** @type {string|SlashCommandClosure} */ value; constructor() { diff --git a/public/scripts/slash-commands/SlashCommandNamedArgumentAutoCompleteOption.js b/public/scripts/slash-commands/SlashCommandNamedArgumentAutoCompleteOption.js index 29f4867fd..e1ca9e894 100644 --- a/public/scripts/slash-commands/SlashCommandNamedArgumentAutoCompleteOption.js +++ b/public/scripts/slash-commands/SlashCommandNamedArgumentAutoCompleteOption.js @@ -1,11 +1,10 @@ import { AutoCompleteOption } from '../autocomplete/AutoCompleteOption.js'; import { SlashCommand } from './SlashCommand.js'; import { SlashCommandNamedArgument } from './SlashCommandArgument.js'; -import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js'; export class SlashCommandNamedArgumentAutoCompleteOption extends AutoCompleteOption { - /**@type {SlashCommandNamedArgument}*/ arg; - /**@type {SlashCommand}*/ cmd; + /** @type {SlashCommandNamedArgument} */ arg; + /** @type {SlashCommand} */ cmd; /** * @param {SlashCommandNamedArgument} arg diff --git a/public/scripts/slash-commands/SlashCommandParser.js b/public/scripts/slash-commands/SlashCommandParser.js index 7f463d684..ea5b2b37b 100644 --- a/public/scripts/slash-commands/SlashCommandParser.js +++ b/public/scripts/slash-commands/SlashCommandParser.js @@ -8,11 +8,9 @@ import { SlashCommandExecutor } from './SlashCommandExecutor.js'; import { SlashCommandParserError } from './SlashCommandParserError.js'; import { AutoCompleteNameResult } from '../autocomplete/AutoCompleteNameResult.js'; import { SlashCommandQuickReplyAutoCompleteOption } from './SlashCommandQuickReplyAutoCompleteOption.js'; -// eslint-disable-next-line no-unused-vars import { SlashCommandScope } from './SlashCommandScope.js'; import { SlashCommandVariableAutoCompleteOption } from './SlashCommandVariableAutoCompleteOption.js'; import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js'; -// eslint-disable-next-line no-unused-vars import { SlashCommandAbortController } from './SlashCommandAbortController.js'; import { SlashCommandAutoCompleteNameResult } from './SlashCommandAutoCompleteNameResult.js'; import { SlashCommandUnnamedArgumentAssignment } from './SlashCommandUnnamedArgumentAssignment.js'; @@ -28,16 +26,18 @@ import { t } from '../i18n.js'; /** @typedef {import('./SlashCommand.js').NamedArgumentsCapture} NamedArgumentsCapture */ /** @typedef {import('./SlashCommand.js').NamedArguments} NamedArguments */ -/**@readonly*/ -/**@enum {Number}*/ +/** + * @enum {Number} + * @readonly + * @typedef {{[id:PARSER_FLAG]:boolean}} ParserFlags + */ export const PARSER_FLAG = { 'STRICT_ESCAPING': 1, 'REPLACE_GETVAR': 2, }; export class SlashCommandParser { - // @ts-ignore - /**@type {Object.}*/ static commands = {}; + /** @type {Object.} */ static commands = {}; /** * @deprecated Use SlashCommandParser.addCommandObject() instead. @@ -101,26 +101,25 @@ export class SlashCommandParser { get commands() { return SlashCommandParser.commands; } - // @ts-ignore - /**@type {Object.}*/ helpStrings = {}; - /**@type {boolean}*/ verifyCommandNames = true; - /**@type {string}*/ text; - /**@type {number}*/ index; - /**@type {SlashCommandAbortController}*/ abortController; - /**@type {SlashCommandDebugController}*/ debugController; - /**@type {SlashCommandScope}*/ scope; - /**@type {SlashCommandClosure}*/ closure; + /** @type {Object.} */ helpStrings = {}; + /** @type {boolean} */ verifyCommandNames = true; + /** @type {string} */ text; + /** @type {number} */ index; + /** @type {SlashCommandAbortController} */ abortController; + /** @type {SlashCommandDebugController} */ debugController; + /** @type {SlashCommandScope} */ scope; + /** @type {SlashCommandClosure} */ closure; - /**@type {Object.}*/ flags = {}; + /** @type {Object.} */ flags = {}; - /**@type {boolean}*/ jumpedEscapeSequence = false; + /** @type {boolean} */ jumpedEscapeSequence = false; - /**@type {{start:number, end:number}[]}*/ closureIndex; - /**@type {{start:number, end:number, name:string}[]}*/ macroIndex; - /**@type {SlashCommandExecutor[]}*/ commandIndex; - /**@type {SlashCommandScope[]}*/ scopeIndex; + /** @type {{start:number, end:number}[]} */ closureIndex; + /** @type {{start:number, end:number, name:string}[]} */ macroIndex; + /** @type {SlashCommandExecutor[]} */ commandIndex; + /** @type {SlashCommandScope[]} */ scopeIndex; - /**@type {string}*/ parserContext; + /** @type {string} */ parserContext; get userIndex() { return this.index; } diff --git a/public/scripts/slash-commands/SlashCommandScope.js b/public/scripts/slash-commands/SlashCommandScope.js index e7ec2a58b..ce4339e29 100644 --- a/public/scripts/slash-commands/SlashCommandScope.js +++ b/public/scripts/slash-commands/SlashCommandScope.js @@ -2,21 +2,21 @@ import { SlashCommandClosure } from './SlashCommandClosure.js'; import { convertValueType } from '../utils.js'; export class SlashCommandScope { - /**@type {string[]}*/ variableNames = []; + /** @type {string[]} */ variableNames = []; get allVariableNames() { const names = [...this.variableNames, ...(this.parent?.allVariableNames ?? [])]; return names.filter((it,idx)=>idx == names.indexOf(it)); } // @ts-ignore - /**@type {object.}*/ variables = {}; + /** @type {object.} */ variables = {}; // @ts-ignore - /**@type {object.}*/ macros = {}; - /**@type {{key:string, value:string|SlashCommandClosure}[]} */ + /** @type {object.} */ macros = {}; + /** @type {{key:string, value:string|SlashCommandClosure}[]} */ get macroList() { return [...Object.keys(this.macros).map(key=>({ key, value:this.macros[key] })), ...(this.parent?.macroList ?? [])]; } - /**@type {SlashCommandScope}*/ parent; - /**@type {string}*/ #pipe; + /** @type {SlashCommandScope} */ parent; + /** @type {string} */ #pipe; get pipe() { return this.#pipe ?? this.parent?.pipe; } diff --git a/public/scripts/slash-commands/SlashCommandUnnamedArgumentAssignment.js b/public/scripts/slash-commands/SlashCommandUnnamedArgumentAssignment.js index 12b28f951..b4db89e01 100644 --- a/public/scripts/slash-commands/SlashCommandUnnamedArgumentAssignment.js +++ b/public/scripts/slash-commands/SlashCommandUnnamedArgumentAssignment.js @@ -1,9 +1,9 @@ import { SlashCommandClosure } from './SlashCommandClosure.js'; export class SlashCommandUnnamedArgumentAssignment { - /**@type {number}*/ start; - /**@type {number}*/ end; - /**@type {string|SlashCommandClosure}*/ value; + /** @type {number} */ start; + /** @type {number} */ end; + /** @type {string|SlashCommandClosure} */ value; constructor() { diff --git a/public/scripts/tags.js b/public/scripts/tags.js index ce6ef89f6..6f7f98298 100644 --- a/public/scripts/tags.js +++ b/public/scripts/tags.js @@ -13,7 +13,6 @@ import { DEFAULT_PRINT_TIMEOUT, printCharacters, } from '../script.js'; -// eslint-disable-next-line no-unused-vars import { FILTER_TYPES, FILTER_STATES, DEFAULT_FILTER_STATE, isFilterState, FilterHelper } from './filters.js'; import { groupCandidatesFilter, groups, selected_group } from './group-chats.js'; diff --git a/public/scripts/variables.js b/public/scripts/variables.js index 0a8412ffd..b2045f3de 100644 --- a/public/scripts/variables.js +++ b/public/scripts/variables.js @@ -9,7 +9,7 @@ import { SlashCommandClosure } from './slash-commands/SlashCommandClosure.js'; import { SlashCommandClosureResult } from './slash-commands/SlashCommandClosureResult.js'; import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js'; import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js'; -import { PARSER_FLAG, SlashCommandParser } from './slash-commands/SlashCommandParser.js'; +import { SlashCommandParser } from './slash-commands/SlashCommandParser.js'; import { slashCommandReturnHelper } from './slash-commands/SlashCommandReturnHelper.js'; import { SlashCommandScope } from './slash-commands/SlashCommandScope.js'; import { isFalseBoolean, convertValueType, isTrueBoolean } from './utils.js'; @@ -583,7 +583,7 @@ export function evalBoolean(rule, a, b) { * Executes a slash command from a string (may be enclosed in quotes) and returns the result. * @param {string} command Command to execute. May contain escaped macro and batch separators. * @param {SlashCommandScope} [scope] The scope to use. - * @param {{[id:PARSER_FLAG]:boolean}} [parserFlags] The parser flags to use. + * @param {import('./slash-commands/SlashCommandParser.js').ParserFlags} [parserFlags] The parser flags to use. * @param {SlashCommandAbortController} [abortController] The abort controller to use. * @returns {Promise} Closure execution result */ From d7dbe736f8dc3798917d346d66371189f8894133 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 19 Mar 2025 21:20:28 +0200 Subject: [PATCH 08/11] Downgrade jsdoc plugin --- package-lock.json | 58 +++++++++++------------------------------------ package.json | 2 +- 2 files changed, 14 insertions(+), 46 deletions(-) diff --git a/package-lock.json b/package-lock.json index 99b56ae79..0dbb64112 100644 --- a/package-lock.json +++ b/package-lock.json @@ -111,7 +111,7 @@ "@types/yargs": "^17.0.33", "@types/yauzl": "^2.10.3", "eslint": "^8.57.1", - "eslint-plugin-jsdoc": "^50.6.8" + "eslint-plugin-jsdoc": "^48.10.0" }, "engines": { "node": ">= 18" @@ -149,15 +149,15 @@ "license": "Apache-2.0" }, "node_modules/@es-joy/jsdoccomment": { - "version": "0.49.0", - "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.49.0.tgz", - "integrity": "sha512-xjZTSFgECpb9Ohuk5yMX5RhUEbfeQcuOp8IF60e+wyzWEF0M5xeSgqsfLtvPEX8BIyOX9saZqzuGPmZ8oWc+5Q==", + "version": "0.46.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.46.0.tgz", + "integrity": "sha512-C3Axuq1xd/9VqFZpW4YAzOx5O9q/LP46uIQy/iNDpHG3fmPa6TBtvfglMCs3RBiBxAIi0Go97r8+jvTt55XMyQ==", "dev": true, "license": "MIT", "dependencies": { "comment-parser": "1.4.1", "esquery": "^1.6.0", - "jsdoc-type-pratt-parser": "~4.1.0" + "jsdoc-type-pratt-parser": "~4.0.0" }, "engines": { "node": ">=16" @@ -3610,18 +3610,17 @@ } }, "node_modules/eslint-plugin-jsdoc": { - "version": "50.6.8", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-50.6.8.tgz", - "integrity": "sha512-PPZVqhoXaalMQwDGzcQrJtPSPIPOYsSMtvkjYAdsIazOW20yhYtVX4+jLL+XznD4zYTXyZbPWPRKkNev4D4lyw==", + "version": "48.10.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-48.10.0.tgz", + "integrity": "sha512-BEli0k8E0dzhJairAllwlkGnyYDZVKNn4WDmyKy+v6J5qGNuofjzxwNUi+55BOGmyO9mKBhqaidwGy+dxndn/Q==", "dev": true, "license": "BSD-3-Clause", "dependencies": { - "@es-joy/jsdoccomment": "~0.49.0", + "@es-joy/jsdoccomment": "~0.46.0", "are-docs-informative": "^0.0.2", "comment-parser": "1.4.1", - "debug": "^4.3.6", + "debug": "^4.3.5", "escape-string-regexp": "^4.0.0", - "espree": "^10.1.0", "esquery": "^1.6.0", "parse-imports": "^2.1.1", "semver": "^7.6.3", @@ -3666,37 +3665,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint-plugin-jsdoc/node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-plugin-jsdoc/node_modules/espree": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", - "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "acorn": "^8.14.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/eslint-plugin-jsdoc/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -5160,9 +5128,9 @@ "license": "MIT" }, "node_modules/jsdoc-type-pratt-parser": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.1.0.tgz", - "integrity": "sha512-Hicd6JK5Njt2QB6XYFS7ok9e37O8AYk3jTcppG4YVQnYjOemymvTcmc7OWsmq/Qqj5TdRFO5/x/tIPmBeRtGHg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.0.0.tgz", + "integrity": "sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index cfd53c7de..4cb0f1bfd 100644 --- a/package.json +++ b/package.json @@ -141,6 +141,6 @@ "@types/yargs": "^17.0.33", "@types/yauzl": "^2.10.3", "eslint": "^8.57.1", - "eslint-plugin-jsdoc": "^50.6.8" + "eslint-plugin-jsdoc": "^48.10.0" } } From a183c8f69ad17b141ad40c8e7d9defa6d8025250 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 19 Mar 2025 21:21:04 +0200 Subject: [PATCH 09/11] Fix the rest of lints --- public/scripts/reasoning.js | 2 +- public/scripts/slash-commands/SlashCommand.js | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/public/scripts/reasoning.js b/public/scripts/reasoning.js index af5f66833..b63b26f63 100644 --- a/public/scripts/reasoning.js +++ b/public/scripts/reasoning.js @@ -6,7 +6,7 @@ import { getRegexedString, regex_placement } from './extensions/regex/engine.js' import { getCurrentLocale, t, translate } from './i18n.js'; import { MacrosParser } from './macros.js'; import { chat_completion_sources, getChatCompletionModel, oai_settings } from './openai.js'; -import { POPUP_RESULT, Popup } from './popup.js'; +import { Popup } from './popup.js'; import { performFuzzySearch, power_user } from './power-user.js'; import { getPresetManager } from './preset-manager.js'; import { SlashCommand } from './slash-commands/SlashCommand.js'; diff --git a/public/scripts/slash-commands/SlashCommand.js b/public/scripts/slash-commands/SlashCommand.js index ee1aafd49..274dac577 100644 --- a/public/scripts/slash-commands/SlashCommand.js +++ b/public/scripts/slash-commands/SlashCommand.js @@ -5,14 +5,10 @@ import { SlashCommandClosure } from './SlashCommandClosure.js'; import { SlashCommandDebugController } from './SlashCommandDebugController.js'; import { SlashCommandScope } from './SlashCommandScope.js'; -/** - * @typedef {import('./SlashCommandParser.js').ParserFlags} ParserFlags - */ - /** * @typedef {{ * _scope:SlashCommandScope, - * _parserFlags:{ParserFlags}, + * _parserFlags:import('./SlashCommandParser.js').ParserFlags, * _abortController:SlashCommandAbortController, * _debugController:SlashCommandDebugController, * _hasUnnamedArgument:boolean, From df5b79a1a428f2e8d9a705af2303113876d316f2 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Wed, 19 Mar 2025 20:24:26 +0100 Subject: [PATCH 10/11] Move run-eslint to PR Manager workflow --- .github/workflows/pr-auto-manager.yml | 35 ++++++++++++++++++++++ .github/workflows/pr-run-eslint.yml | 43 --------------------------- 2 files changed, 35 insertions(+), 43 deletions(-) delete mode 100644 .github/workflows/pr-run-eslint.yml diff --git a/.github/workflows/pr-auto-manager.yml b/.github/workflows/pr-auto-manager.yml index 261c5b069..d95ff8e73 100644 --- a/.github/workflows/pr-auto-manager.yml +++ b/.github/workflows/pr-auto-manager.yml @@ -11,6 +11,41 @@ permissions: pull-requests: write jobs: + run-eslint: + name: ✅ Check ESLint on PR + runs-on: ubuntu-latest + # Only needs to run when code is changed + if: github.event.action == 'opened' || github.event.action == 'synchronize' + + steps: + - name: Checkout Repository + # Checkout + # https://github.com/marketplace/actions/checkout + uses: actions/checkout@v4.2.2 + + - name: Setup Node.js + # Setup Node.js environment + # https://github.com/marketplace/actions/setup-node-js-environment + uses: actions/setup-node@v4.3.0 + with: + node-version: 20 + + - name: Run npm install + run: npm ci + + - name: Run ESLint + # Action ESLint + # https://github.com/marketplace/actions/action-eslint + uses: sibiraj-s/action-eslint@v3.0.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + eslint-args: '--ignore-path=.gitignore --quiet' + extensions: 'js,ts' + annotations: true + ignore-patterns: | + dist/ + lib/ + label-by-size: name: 🏷️ Label PR by Size # This job should run after all others, to prevent possible concurrency issues diff --git a/.github/workflows/pr-run-eslint.yml b/.github/workflows/pr-run-eslint.yml deleted file mode 100644 index 4e30608c9..000000000 --- a/.github/workflows/pr-run-eslint.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: ✅ Check ESLint on PR - -on: - pull_request: # TODO: change to pull_request_target for 'staging' - types: [opened, synchronize] - -permissions: - contents: read - pull-requests: write - -jobs: - run-eslint: - name: ✅ Check ESLint on PR - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - # Checkout - # https://github.com/marketplace/actions/checkout - uses: actions/checkout@v4.2.2 - - - name: Setup Node.js - # Setup Node.js environment - # https://github.com/marketplace/actions/setup-node-js-environment - uses: actions/setup-node@v4.3.0 - with: - node-version: 20 - - - name: Run npm install - run: npm ci - - - name: Run ESLint - # Action ESLint - # https://github.com/marketplace/actions/action-eslint - uses: sibiraj-s/action-eslint@v3.0.1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - eslint-args: '--ignore-path=.gitignore --quiet' - extensions: 'js,ts' - annotations: true - ignore-patterns: | - dist/ - lib/ From af0939038b9cd15cc595d4734c5362047b0bc83e Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 19 Mar 2025 21:26:38 +0200 Subject: [PATCH 11/11] Fix undefined type references --- public/scripts/PromptManager.js | 2 +- public/scripts/slash-commands.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/public/scripts/PromptManager.js b/public/scripts/PromptManager.js index 783fb0c81..6e515baa1 100644 --- a/public/scripts/PromptManager.js +++ b/public/scripts/PromptManager.js @@ -4,7 +4,7 @@ import { DOMPurify, Popper } from '../lib.js'; import { event_types, eventSource, is_send_press, main_api, substituteParams } from '../script.js'; import { is_group_generating } from './group-chats.js'; -import { Message, TokenHandler } from './openai.js'; +import { Message, MessageCollection, TokenHandler } from './openai.js'; import { power_user } from './power-user.js'; import { debounce, waitUntilCondition, escapeHtml } from './utils.js'; import { debounce_timeout } from './constants.js'; diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index 279c06c04..096da917a 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -75,6 +75,8 @@ import { SlashCommandBreakController } from './slash-commands/SlashCommandBreakC import { SlashCommandExecutionError } from './slash-commands/SlashCommandExecutionError.js'; import { slashCommandReturnHelper } from './slash-commands/SlashCommandReturnHelper.js'; import { accountStorage } from './util/AccountStorage.js'; +import { SlashCommandDebugController } from './slash-commands/SlashCommandDebugController.js'; +import { SlashCommandScope } from './slash-commands/SlashCommandScope.js'; export { executeSlashCommands, executeSlashCommandsWithOptions, getSlashCommandsHelp, registerSlashCommand, }; @@ -4345,7 +4347,7 @@ const clearCommandProgressDebounced = debounce(clearCommandProgress); * @prop {boolean} [handleParserErrors] (true) Whether to handle parser errors (show toast on error) or throw. * @prop {SlashCommandScope} [scope] (null) The scope to be used when executing the commands. * @prop {boolean} [handleExecutionErrors] (false) Whether to handle execution errors (show toast on error) or throw - * @prop {{[id:PARSER_FLAG]:boolean}} [parserFlags] (null) Parser flags to apply + * @prop {import('./slash-commands/SlashCommandParser.js').ParserFlags} [parserFlags] (null) Parser flags to apply * @prop {SlashCommandAbortController} [abortController] (null) Controller used to abort or pause command execution * @prop {SlashCommandDebugController} [debugController] (null) Controller used to control debug execution * @prop {(done:number, total:number)=>void} [onProgress] (null) Callback to handle progress events @@ -4355,7 +4357,7 @@ const clearCommandProgressDebounced = debounce(clearCommandProgress); /** * @typedef ExecuteSlashCommandsOnChatInputOptions * @prop {SlashCommandScope} [scope] (null) The scope to be used when executing the commands. - * @prop {{[id:PARSER_FLAG]:boolean}} [parserFlags] (null) Parser flags to apply + * @prop {import('./slash-commands/SlashCommandParser.js').ParserFlags} [parserFlags] (null) Parser flags to apply * @prop {boolean} [clearChatInput] (false) Whether to clear the chat input textarea * @prop {string} [source] (null) String indicating where the code come from (e.g., QR name) */