mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-02 12:26:59 +01:00
lint: Fix JSdocs
This commit is contained in:
parent
b09ebb240e
commit
91811f63b5
24
.eslintrc.js
24
.eslintrc.js
@ -1,31 +1,31 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: [
|
||||
'eslint:recommended'
|
||||
'eslint:recommended',
|
||||
],
|
||||
env: {
|
||||
es6: true
|
||||
es6: true,
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 'latest'
|
||||
ecmaVersion: 'latest',
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
// Server-side files (plus this configuration file)
|
||||
files: ['src/**/*.js', 'server.js', '.eslintrc.js'],
|
||||
env: {
|
||||
node: true
|
||||
}
|
||||
node: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
// Browser-side files
|
||||
files: ['public/**/*.js'],
|
||||
env: {
|
||||
browser: true,
|
||||
jquery: true
|
||||
jquery: true,
|
||||
},
|
||||
parserOptions: {
|
||||
sourceType: 'module'
|
||||
sourceType: 'module',
|
||||
},
|
||||
// These scripts are loaded in HTML; tell ESLint not to complain about them being undefined
|
||||
globals: {
|
||||
@ -41,9 +41,9 @@ module.exports = {
|
||||
showdown: 'readonly',
|
||||
showdownKatex: 'readonly',
|
||||
SVGInject: 'readonly',
|
||||
toastr: 'readonly'
|
||||
}
|
||||
}
|
||||
toastr: 'readonly',
|
||||
},
|
||||
},
|
||||
],
|
||||
// There are various vendored libraries that shouldn't be linted
|
||||
ignorePatterns: ['public/lib/**/*', '*.min.js', 'src/ai_horde/**/*'],
|
||||
@ -56,9 +56,11 @@ module.exports = {
|
||||
'semi': ['error', 'always'],
|
||||
'indent': ['error', 4, { SwitchCase: 1, FunctionDeclaration: { parameters: 'first' } }],
|
||||
'comma-dangle': ['error', 'always-multiline'],
|
||||
'eol-last': ['error', 'always'],
|
||||
'no-trailing-spaces': 'error',
|
||||
|
||||
// These rules should eventually be enabled.
|
||||
'no-async-promise-executor': 'off',
|
||||
'no-inner-declarations': 'off',
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -6261,6 +6261,15 @@ function onScenarioOverrideRemoveClick() {
|
||||
$(this).closest('.scenario_override').find('.chat_scenario').val('').trigger('input');
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a blocking popup with a given text and type.
|
||||
* @param {JQuery<HTMLElement>|string|Element} text - Text to display in the popup.
|
||||
* @param {string} type
|
||||
* @param {string} inputValue - Value to set the input to.
|
||||
* @param {PopupOptions} options - Options for the popup.
|
||||
* @typedef {{okButton?: string, rows?: number, wide?: boolean, large?: boolean }} PopupOptions - Options for the popup.
|
||||
* @returns
|
||||
*/
|
||||
function callPopup(text, type, inputValue = '', { okButton, rows, wide, large } = {}) {
|
||||
dialogueCloseStop = true;
|
||||
if (type) {
|
||||
|
@ -25,4 +25,4 @@ export function hideLoader() {
|
||||
'filter': 'blur(15px)',
|
||||
'opacity': '0',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -127,15 +127,13 @@ function createHtml(statsType, stats) {
|
||||
|
||||
/**
|
||||
* Handles the user stats by getting them from the server, calculating the total and generating the HTML report.
|
||||
*
|
||||
* @param {Object} charStats - Object containing character statistics.
|
||||
*/
|
||||
async function userStatsHandler() {
|
||||
// Get stats from server
|
||||
await getStats();
|
||||
|
||||
// Calculate total stats
|
||||
let totalStats = calculateTotalStats(charStats);
|
||||
let totalStats = calculateTotalStats();
|
||||
|
||||
// Create HTML with stats
|
||||
createHtml('User', totalStats);
|
||||
@ -144,7 +142,6 @@ async function userStatsHandler() {
|
||||
/**
|
||||
* Handles the character stats by getting them from the server and generating the HTML report.
|
||||
*
|
||||
* @param {Object} charStats - Object containing character statistics.
|
||||
* @param {Object} characters - Object containing character data.
|
||||
* @param {string} this_chid - The character id.
|
||||
*/
|
||||
@ -173,9 +170,6 @@ async function characterStatsHandler(characters, this_chid) {
|
||||
|
||||
/**
|
||||
* Fetches the character stats from the server.
|
||||
*
|
||||
* @param {Object} charStats - Object containing character statistics.
|
||||
* @returns {Object} - Object containing fetched character statistics.
|
||||
*/
|
||||
async function getStats() {
|
||||
const response = await fetch('/getstats', {
|
||||
@ -231,13 +225,11 @@ function calculateGenTime(gen_started, gen_finished) {
|
||||
}
|
||||
let startDate = new Date(gen_started);
|
||||
let endDate = new Date(gen_finished);
|
||||
return endDate - startDate;
|
||||
return endDate.getTime() - startDate.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a POST request to the server to update the statistics.
|
||||
*
|
||||
* @param {Object} stats - The stats data to update.
|
||||
*/
|
||||
async function updateStats() {
|
||||
const response = await fetch('/updatestats', {
|
||||
@ -248,7 +240,7 @@ async function updateStats() {
|
||||
|
||||
if (response.status !== 200) {
|
||||
console.error('Failed to update stats');
|
||||
console.log(response).status;
|
||||
console.log(response.status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -271,7 +263,6 @@ function countWords(str) {
|
||||
* @param {string} type - The type of the message processing (e.g., 'append', 'continue', 'appendFinal', 'swipe').
|
||||
* @param {Object} characters - Object containing character data.
|
||||
* @param {string} this_chid - The character id.
|
||||
* @param {Object} charStats - Object containing character statistics.
|
||||
* @param {string} oldMesssage - The old message that's being processed.
|
||||
*/
|
||||
async function statMesProcess(line, type, characters, this_chid, oldMesssage) {
|
||||
|
@ -8,7 +8,8 @@ import {
|
||||
entitiesFilter,
|
||||
printCharacters,
|
||||
} from '../script.js';
|
||||
import { FILTER_TYPES } from './filters.js';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { FILTER_TYPES, FilterHelper } from './filters.js';
|
||||
|
||||
import { groupCandidatesFilter, groups, selected_group } from './group-chats.js';
|
||||
import { download, onlyUnique, parseJsonFile, uuidv4 } from './utils.js';
|
||||
@ -283,6 +284,14 @@ function createNewTag(tagName) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a tag to the list element.
|
||||
* @param {string} listElement List element selector.
|
||||
* @param {object} tag Tag object.
|
||||
* @param {TagOptions} options Options for the tag.
|
||||
* @typedef {{removable?: boolean, selectable?: boolean, action?: function, isGeneralList?: boolean}} TagOptions
|
||||
* @returns {void}
|
||||
*/
|
||||
function appendTagToList(listElement, tag, { removable, selectable, action, isGeneralList }) {
|
||||
if (!listElement) {
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user