mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-09 00:28:52 +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 = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
extends: [
|
extends: [
|
||||||
'eslint:recommended'
|
'eslint:recommended',
|
||||||
],
|
],
|
||||||
env: {
|
env: {
|
||||||
es6: true
|
es6: true,
|
||||||
},
|
},
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
ecmaVersion: 'latest'
|
ecmaVersion: 'latest',
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
// Server-side files (plus this configuration file)
|
// Server-side files (plus this configuration file)
|
||||||
files: ['src/**/*.js', 'server.js', '.eslintrc.js'],
|
files: ['src/**/*.js', 'server.js', '.eslintrc.js'],
|
||||||
env: {
|
env: {
|
||||||
node: true
|
node: true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Browser-side files
|
// Browser-side files
|
||||||
files: ['public/**/*.js'],
|
files: ['public/**/*.js'],
|
||||||
env: {
|
env: {
|
||||||
browser: true,
|
browser: true,
|
||||||
jquery: true
|
jquery: true,
|
||||||
},
|
},
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
sourceType: 'module'
|
sourceType: 'module',
|
||||||
},
|
},
|
||||||
// These scripts are loaded in HTML; tell ESLint not to complain about them being undefined
|
// These scripts are loaded in HTML; tell ESLint not to complain about them being undefined
|
||||||
globals: {
|
globals: {
|
||||||
@ -41,9 +41,9 @@ module.exports = {
|
|||||||
showdown: 'readonly',
|
showdown: 'readonly',
|
||||||
showdownKatex: 'readonly',
|
showdownKatex: 'readonly',
|
||||||
SVGInject: 'readonly',
|
SVGInject: 'readonly',
|
||||||
toastr: 'readonly'
|
toastr: 'readonly',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
// There are various vendored libraries that shouldn't be linted
|
// There are various vendored libraries that shouldn't be linted
|
||||||
ignorePatterns: ['public/lib/**/*', '*.min.js', 'src/ai_horde/**/*'],
|
ignorePatterns: ['public/lib/**/*', '*.min.js', 'src/ai_horde/**/*'],
|
||||||
@ -56,9 +56,11 @@ module.exports = {
|
|||||||
'semi': ['error', 'always'],
|
'semi': ['error', 'always'],
|
||||||
'indent': ['error', 4, { SwitchCase: 1, FunctionDeclaration: { parameters: 'first' } }],
|
'indent': ['error', 4, { SwitchCase: 1, FunctionDeclaration: { parameters: 'first' } }],
|
||||||
'comma-dangle': ['error', 'always-multiline'],
|
'comma-dangle': ['error', 'always-multiline'],
|
||||||
|
'eol-last': ['error', 'always'],
|
||||||
|
'no-trailing-spaces': 'error',
|
||||||
|
|
||||||
// These rules should eventually be enabled.
|
// These rules should eventually be enabled.
|
||||||
'no-async-promise-executor': 'off',
|
'no-async-promise-executor': 'off',
|
||||||
'no-inner-declarations': 'off',
|
'no-inner-declarations': 'off',
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
@ -6261,6 +6261,15 @@ function onScenarioOverrideRemoveClick() {
|
|||||||
$(this).closest('.scenario_override').find('.chat_scenario').val('').trigger('input');
|
$(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 } = {}) {
|
function callPopup(text, type, inputValue = '', { okButton, rows, wide, large } = {}) {
|
||||||
dialogueCloseStop = true;
|
dialogueCloseStop = true;
|
||||||
if (type) {
|
if (type) {
|
||||||
|
@ -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.
|
* 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() {
|
async function userStatsHandler() {
|
||||||
// Get stats from server
|
// Get stats from server
|
||||||
await getStats();
|
await getStats();
|
||||||
|
|
||||||
// Calculate total stats
|
// Calculate total stats
|
||||||
let totalStats = calculateTotalStats(charStats);
|
let totalStats = calculateTotalStats();
|
||||||
|
|
||||||
// Create HTML with stats
|
// Create HTML with stats
|
||||||
createHtml('User', totalStats);
|
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.
|
* 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 {Object} characters - Object containing character data.
|
||||||
* @param {string} this_chid - The character id.
|
* @param {string} this_chid - The character id.
|
||||||
*/
|
*/
|
||||||
@ -173,9 +170,6 @@ async function characterStatsHandler(characters, this_chid) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the character stats from the server.
|
* Fetches the character stats from the server.
|
||||||
*
|
|
||||||
* @param {Object} charStats - Object containing character statistics.
|
|
||||||
* @returns {Object} - Object containing fetched character statistics.
|
|
||||||
*/
|
*/
|
||||||
async function getStats() {
|
async function getStats() {
|
||||||
const response = await fetch('/getstats', {
|
const response = await fetch('/getstats', {
|
||||||
@ -231,13 +225,11 @@ function calculateGenTime(gen_started, gen_finished) {
|
|||||||
}
|
}
|
||||||
let startDate = new Date(gen_started);
|
let startDate = new Date(gen_started);
|
||||||
let endDate = new Date(gen_finished);
|
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.
|
* Sends a POST request to the server to update the statistics.
|
||||||
*
|
|
||||||
* @param {Object} stats - The stats data to update.
|
|
||||||
*/
|
*/
|
||||||
async function updateStats() {
|
async function updateStats() {
|
||||||
const response = await fetch('/updatestats', {
|
const response = await fetch('/updatestats', {
|
||||||
@ -248,7 +240,7 @@ async function updateStats() {
|
|||||||
|
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
console.error('Failed to update stats');
|
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 {string} type - The type of the message processing (e.g., 'append', 'continue', 'appendFinal', 'swipe').
|
||||||
* @param {Object} characters - Object containing character data.
|
* @param {Object} characters - Object containing character data.
|
||||||
* @param {string} this_chid - The character id.
|
* @param {string} this_chid - The character id.
|
||||||
* @param {Object} charStats - Object containing character statistics.
|
|
||||||
* @param {string} oldMesssage - The old message that's being processed.
|
* @param {string} oldMesssage - The old message that's being processed.
|
||||||
*/
|
*/
|
||||||
async function statMesProcess(line, type, characters, this_chid, oldMesssage) {
|
async function statMesProcess(line, type, characters, this_chid, oldMesssage) {
|
||||||
|
@ -8,7 +8,8 @@ import {
|
|||||||
entitiesFilter,
|
entitiesFilter,
|
||||||
printCharacters,
|
printCharacters,
|
||||||
} from '../script.js';
|
} 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 { groupCandidatesFilter, groups, selected_group } from './group-chats.js';
|
||||||
import { download, onlyUnique, parseJsonFile, uuidv4 } from './utils.js';
|
import { download, onlyUnique, parseJsonFile, uuidv4 } from './utils.js';
|
||||||
@ -283,6 +284,14 @@ function createNewTag(tagName) {
|
|||||||
return tag;
|
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 }) {
|
function appendTagToList(listElement, tag, { removable, selectable, action, isGeneralList }) {
|
||||||
if (!listElement) {
|
if (!listElement) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user