File size: 1,631 Bytes
bc20498 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
import type { Comment, SvelteProgram, Token } from "../ast";
import type { Program } from "estree";
import type { ScopeManager } from "eslint-scope";
import type * as SvAST from "./svelte-ast-types";
import type * as Compiler from "./svelte-ast-types-for-v5";
import { type StyleContext, type StyleContextNoStyleElement, type StyleContextParseError, type StyleContextSuccess, type StyleContextUnknownLang } from "./style-context";
import { type SvelteParseContext } from "./svelte-parse-context";
export { StyleContext, StyleContextNoStyleElement, StyleContextParseError, StyleContextSuccess, StyleContextUnknownLang, };
export interface ESLintProgram extends Program {
comments: Comment[];
tokens: Token[];
}
/**
* The parsing result of ESLint custom parsers.
*/
export interface ESLintExtendedProgram {
ast: ESLintProgram;
services?: Record<string, any>;
visitorKeys?: {
[type: string]: string[];
};
scopeManager?: ScopeManager;
_virtualScriptCode?: string;
}
type ParseResult = {
ast: SvelteProgram;
services: Record<string, any> & ({
isSvelte: true;
isSvelteScript: false;
getSvelteHtmlAst: () => SvAST.Fragment | Compiler.Fragment;
getStyleContext: () => StyleContext;
svelteParseContext: SvelteParseContext;
} | {
isSvelte: false;
isSvelteScript: true;
svelteParseContext: SvelteParseContext;
});
visitorKeys: {
[type: string]: string[];
};
scopeManager: ScopeManager;
};
/**
* Parse source code
*/
export declare function parseForESLint(code: string, options?: any): ParseResult;
|