UNPKG

2.01 kBTypeScriptView Raw
1/// <reference types="node" />
2import { URL } from 'url';
3import { ProblemLocation, Severity, CodeFix } from '@hint/utils-types';
4import { ProblemDocumentation } from '@hint/utils-types';
5import { HTMLElement } from '@hint/utils-dom';
6import { Engine } from './engine';
7import { Events, HintMetadata, NetworkData, StringKeyOf } from './types';
8export declare type CodeLanguage = 'css' | 'html' | 'http' | 'javascript';
9export declare type ReportOptions = {
10 attribute?: string;
11 browsers?: string[];
12 codeSnippet?: string;
13 content?: string;
14 documentation?: ProblemDocumentation[];
15 element?: HTMLElement | null;
16 location?: ProblemLocation | null;
17 severity: Severity;
18 forceSeverity?: boolean;
19 codeLanguage?: CodeLanguage;
20 fixes?: CodeFix[];
21};
22export declare class HintContext<E extends Events = Events> {
23 private id;
24 private options;
25 private meta;
26 private severity;
27 private engine;
28 private ignoredUrls;
29 constructor(hintId: string, engine: Engine<E>, severity: Severity, options: any, meta: HintMetadata, ignoredUrls: RegExp[]);
30 get engineKey(): object;
31 get pageDOM(): import("@hint/utils-dom").HTMLDocument | undefined;
32 get pageContent(): string | undefined;
33 get pageHeaders(): import("@hint/utils-types").HttpHeaders | undefined;
34 get targetedBrowsers(): string[];
35 get hintOptions(): any;
36 evaluate(source: string): Promise<any>;
37 fetchContent(target: string | URL, headers?: object): Promise<NetworkData>;
38 querySelectorAll(selector: string): HTMLElement[];
39 private adjustFixLocations;
40 findProblemLocation(element: HTMLElement, offset: ProblemLocation | null, attribute?: string): ProblemLocation | null;
41 report(resource: string, message: string, options: ReportOptions): void;
42 on<K extends StringKeyOf<E>>(event: K, listener: (data: E[K], event: string) => void): void;
43 isUrlIgnored(resource: string): boolean;
44 get language(): string;
45}
46//# sourceMappingURL=hint-context.d.ts.map
\No newline at end of file