declare interface Config { std: string | object; [key: string]: unknown; } declare interface Warning { code: string; line: number; column: number; end_column: number; } export interface Diagnostic extends Warning { msg: string; severity: 0 | 1 | 2; } declare type checkFuncAsync = (s: string, std?: string | Config) => Promise; declare class Luacheck { #private; /** * @param check Luacheck * @param std 全局变量集或Luacheck配置对象 */ constructor(check: checkFuncAsync, std?: string | Config); /** * Update the standard globals or configuration object * * 更新全局变量集或配置对象 * @param std standard globals or a Luacheck configuration object / 全局变量集或Luacheck配置对象 */ setConfig(std?: string | Config): void; /** * Queue a syntax check * * 提交语法分析 * @param text code to check / 待分析的代码 * @description * - Always update `#text` so that when `#lint` finishes it can check if it needs to re-run * - If there is already a check running, return its result * - Otherwise, start a new check * * - 总是更新`#text`以便`#lint`完成时可以判断是否需要重新分析 * - 如果已有进行中的分析,则返回该分析的结果 * - 否则开始新的分析 */ queue(text: string): Promise; } /** * Create a `Luacheck` instance * * 创建一个`Luacheck`实例 * @param std {@link https://luacheck.readthedocs.io/en/stable/config.html#custom-sets-of-globals standard globals } * or a {@link https://luacheck.readthedocs.io/en/stable/config.html#config-options Luacheck configuration object } * / {@link https://luacheck.readthedocs.io/en/stable/config.html#custom-sets-of-globals 全局变量集} * 或{@link https://luacheck.readthedocs.io/en/stable/config.html#config-options Luacheck配置对象} */ declare const luaCheck: { (std?: string | Config): Luacheck; check: checkFuncAsync; }; declare global { const luacheck: typeof luaCheck; } export {};