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 */