Fix unfixable lints

This commit is contained in:
Cohee
2025-03-19 21:10:34 +02:00
parent 73520b923f
commit 0af4a3ebd7
28 changed files with 336 additions and 135 deletions

View File

@ -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,

View File

@ -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';

View File

@ -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;

View File

@ -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<boolean>} */ continuePromise;
/**@type {(boolean)=>void} */ continueResolver;
/** @type {Promise<boolean>} */ continuePromise;
/** @type {(boolean)=>void} */ continueResolver;
/**@type {(closure:SlashCommandClosure, executor:SlashCommandExecutor)=>Promise<boolean>} */ onBreakPoint;
/** @type {(closure:SlashCommandClosure, executor:SlashCommandExecutor)=>Promise<boolean>} */ onBreakPoint;

View File

@ -1,7 +1,3 @@
import { SlashCommandExecutor } from './SlashCommandExecutor.js';
import { SlashCommandScope } from './SlashCommandScope.js';
/**
* @typedef {'enum' | 'command' | 'namedArgument' | 'variable' | 'qr' | 'macro' | 'number' | 'name'} EnumType
*/

View File

@ -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

View File

@ -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() {

View File

@ -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

View File

@ -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.<string, SlashCommand>}*/ static commands = {};
/** @type {Object.<string, SlashCommand>} */ static commands = {};
/**
* @deprecated Use SlashCommandParser.addCommandObject() instead.
@ -101,26 +101,25 @@ export class SlashCommandParser {
get commands() {
return SlashCommandParser.commands;
}
// @ts-ignore
/**@type {Object.<string, string>}*/ 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.<string, string>} */ 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.<PARSER_FLAG,boolean>}*/ flags = {};
/** @type {Object.<PARSER_FLAG,boolean>} */ 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; }

View File

@ -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.<string, string|SlashCommandClosure>}*/ variables = {};
/** @type {object.<string, string|SlashCommandClosure>} */ variables = {};
// @ts-ignore
/**@type {object.<string, string|SlashCommandClosure>}*/ macros = {};
/**@type {{key:string, value:string|SlashCommandClosure}[]} */
/** @type {object.<string, string|SlashCommandClosure>} */ 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;
}

View File

@ -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() {