hint
- Version 7.1.13
- Published
- 924 kB
- 18 dependencies
- Apache-2.0 license
Install
npm i hint
yarn add hint
pnpm add hint
Overview
The linting tool for the web
Index
Variables
Classes
Interfaces
Enums
Type Aliases
- AnalyzeOptions
- AnalyzerResult
- AnalyzerTargetEnd
- AnalyzerTargetStart
- AnalyzerTargetUpdate
- BrowserInfo
- CanEvaluateScript
- CLIOptions
- CodeLanguage
- CreateAnalyzerOptions
- ElementEvents
- ElementFound
- Endpoint
- ErrorEvent
- Event
- Events
- FetchEnd
- FetchError
- FetchStart
- FormatterOptions
- HintMetadata
- HintResources
- LauncherOptions
- MetadataDocs
- NetworkData
- PrintEvent
- ReportOptions
- Request
- Resource
- Response
- ResponseBody
- ScanEnd
- ScanStart
- StringKeyOf
- Target
- TraverseDown
- TraverseEnd
- TraverseStart
- TraverseUp
Variables
variable createAnalyzer
const createAnalyzer: ( userConfiguration: UserConfig, options?: CreateAnalyzerOptions) => Analyzer;
variable getUserConfig
const getUserConfig: (filePath?: string) => any;
variable utils
const utils: typeof allUtils;
Classes
class Analyzer
class Analyzer {}
property resources
readonly resources: HintResources;
method analyze
analyze: ( endpoints: Endpoint | Endpoint[], options?: AnalyzeOptions) => Promise<AnalyzerResult[]>;
method close
close: () => Promise<void>;
method create
static create: ( userConfiguration: UserConfig, options?: CreateAnalyzerOptions) => Analyzer;
method format
format: (problems: Problem[], options?: FormatterOptions) => Promise<void>;
method getUserConfig
static getUserConfig: (filePath?: string) => UserConfig | null;
class AnalyzerError
class AnalyzerError extends Error {}
constructor
constructor( error: string | Error, status: AnalyzerErrorStatus, items?: HintResources | string[]);
property invalidHints
invalidHints?: string[];
property resources
resources?: HintResources;
property status
status: AnalyzerErrorStatus;
class Configuration
class Configuration {}
property browserslist
readonly browserslist: string[];
property connector
readonly connector: any;
property extends
readonly extends: string[];
property formatters
readonly formatters: string[];
property getFilenameForDirectory
static getFilenameForDirectory: (directory: string) => string | null;
property hints
readonly hints: HintsConfigObject;
property hintsTimeout
readonly hintsTimeout: number;
property ignoredUrls
readonly ignoredUrls: Map<string, RegExp[]>;
property language
readonly language: string;
property parsers
readonly parsers: string[];
method fromConfig
static fromConfig: ( config: UserConfig | null, options?: CreateAnalyzerOptions) => Configuration;
method loadConfigFile
static loadConfigFile: (filePath: string) => UserConfig | null;
method toAbsolutePaths
static toAbsolutePaths: ( config: UserConfig | null, configRoot: string) => UserConfig | null;
method validateConnectorConfig
static validateConnectorConfig: (config: Configuration) => boolean;
method validateHintsConfig
static validateHintsConfig: (config: Configuration) => { invalid: string[]; valid: string[];};
class Engine
class Engine<E extends Events = Events> extends EventEmitter {}
constructor
constructor(config: Configuration, resources: HintResources);
property formatters
readonly formatters: IFormatter[];
property language
readonly language: string;
property pageContent
readonly pageContent: string;
property pageDOM
readonly pageDOM: any;
property pageHeaders
readonly pageHeaders: any;
property targetedBrowsers
readonly targetedBrowsers: string[];
property timeout
readonly timeout: number;
method clean
clean: (fileUrl: url.URL) => void;
method clear
clear: () => void;
method close
close: () => Promise<void>;
method emit
emit: <K extends Extract<keyof E, string>>(event: K, data: E[K]) => boolean;
method emitAsync
emitAsync: <K extends Extract<keyof E, string>>( event: K, data: E[K]) => Promise<any[]>;
method evaluate
evaluate: (source: string) => Promise<any>;
method executeOn
executeOn: (target: url.URL, options?: IFetchOptions) => Promise<Problem[]>;
method fetchContent
fetchContent: ( target: string | url.URL, headers?: object) => Promise<NetworkData>;
method notify
notify: (this: Engine<Events>, resource: string) => Promise<void>;
method on
on: <K extends Extract<keyof E, string>>( event: K, listener: (data: E[K]) => void) => this | Listener;
method onHintEvent
onHintEvent: <K extends Extract<keyof E, string>>( id: string, eventName: K, listener: (data: E[K], event: string) => void) => void;
method querySelectorAll
querySelectorAll: (selector: string) => HTMLElement[];
method report
report: (problem: Problem) => void;
class HintContext
class HintContext<E extends Events = Events> {}
constructor
constructor( hintId: string, engine: Engine<E>, severity: Severity, options: any, meta: HintMetadata, ignoredUrls: RegExp[]);
property engineKey
readonly engineKey: {};
property hintOptions
readonly hintOptions: any;
property language
readonly language: string;
property pageContent
readonly pageContent: string;
property pageDOM
readonly pageDOM: any;
property pageHeaders
readonly pageHeaders: any;
property targetedBrowsers
readonly targetedBrowsers: string[];
method evaluate
evaluate: (source: string) => Promise<any>;
method fetchContent
fetchContent: (target: string | URL, headers?: object) => Promise<NetworkData>;
method findProblemLocation
findProblemLocation: ( element: HTMLElement, offset: ProblemLocation | null, attribute?: string) => ProblemLocation | null;
method isUrlIgnored
isUrlIgnored: (resource: string) => boolean;
method on
on: <K extends Extract<keyof E, string>>( event: K, listener: (data: E[K], event: string) => void) => void;
method querySelectorAll
querySelectorAll: (selector: string) => HTMLElement[];
method report
report: (resource: string, message: string, options: ReportOptions) => void;
class Parser
abstract class Parser<E extends Events = Events> {}
constructor
constructor(engine: Engine<E>, parseEventType: string);
property engine
protected engine: Engine<E>;
property name
protected name: string;
Interfaces
interface IConnector
interface IConnector {}
property dom
dom?: HTMLDocument;
property headers
headers?: HttpHeaders;
property html
html?: string;
method close
close: () => Promise<void>;
method collect
collect: (target: url.URL, options?: IFetchOptions) => Promise<any>;
method evaluate
evaluate: (code: string) => Promise<any>;
method fetchContent
fetchContent: ( target: url.URL | string, customHeaders?: object, options?: IFetchOptions) => Promise<NetworkData>;
method querySelectorAll
querySelectorAll: (query: string) => HTMLElement[];
interface IConnectorConstructor
interface IConnectorConstructor {}
property schema
schema: any;
construct signature
new (server: Engine, config?: object, launcher?: ILauncher): IConnector;
interface IFetchOptions
interface IFetchOptions {}
property content
content?: string;
interface IFormatter
interface IFormatter {}
method format
format: (problems: Problem[], options?: FormatterOptions) => void;
interface IFormatterConstructor
interface IFormatterConstructor {}
construct signature
new (): IFormatter;
interface IHint
interface IHint {}
interface IHintConstructor
interface IHintConstructor {}
property meta
meta: HintMetadata;
construct signature
new (context: HintContext): IHint;
interface ILauncher
interface ILauncher {}
interface IParserConstructor
interface IParserConstructor {}
construct signature
new (engine: Engine): Parser;
Enums
enum AnalyzerErrorStatus
enum AnalyzerErrorStatus { AnalyzeError = 'AnalyzeError', ConfigurationError = 'ConfigurationError', ConnectorError = 'ConnectorError', HintError = 'HintError', ResourceError = 'ResourceError',}
member AnalyzeError
AnalyzeError = 'AnalyzeError'
member ConfigurationError
ConfigurationError = 'ConfigurationError'
member ConnectorError
ConnectorError = 'ConnectorError'
member HintError
HintError = 'HintError'
member ResourceError
ResourceError = 'ResourceError'
Type Aliases
type AnalyzeOptions
type AnalyzeOptions = { language?: string; targetEndCallback?: (targetEvent: AnalyzerTargetEnd) => Promise<void> | void; targetStartCallback?: (targetEvent: AnalyzerTargetStart) => Promise<void> | void; updateCallback?: (update: AnalyzerTargetUpdate) => Promise<void> | void;};
type AnalyzerResult
type AnalyzerResult = { url: string; problems: Problem[];};
type AnalyzerTargetEnd
type AnalyzerTargetEnd = AnalyzerTargetStart & { problems: Problem[];};
type AnalyzerTargetStart
type AnalyzerTargetStart = { url: string;};
type AnalyzerTargetUpdate
type AnalyzerTargetUpdate = AnalyzerTargetStart & { message: string; resource?: string;};
type BrowserInfo
type BrowserInfo = { isNew?: boolean; pid: number; port?: number;};
type CanEvaluateScript
type CanEvaluateScript = Event & { document: HTMLDocument;};
type CLIOptions
type CLIOptions = { _: string[]; 'analytics-debug': boolean; config: string; debug: boolean; help: boolean; language: string; output: string; version: boolean; watch: boolean; formatters: string; hints: string;};
type CodeLanguage
type CodeLanguage = 'css' | 'html' | 'http' | 'javascript';
type CreateAnalyzerOptions
type CreateAnalyzerOptions = { formatters?: string[]; hints?: string[]; watch?: boolean;};
type ElementEvents
type ElementEvents = { 'element::*': ElementFound; 'element::a': ElementFound; 'element::abbr': ElementFound; 'element::acronym': ElementFound; 'element::address': ElementFound; 'element::applet': ElementFound; 'element::area': ElementFound; 'element::article': ElementFound; 'element::aside': ElementFound; 'element::audio': ElementFound; 'element::b': ElementFound; 'element::base': ElementFound; 'element::basefont': ElementFound; 'element::bdi': ElementFound; 'element::bdo': ElementFound; 'element::bgsound': ElementFound; 'element::big': ElementFound; 'element::blink': ElementFound; 'element::blockquote': ElementFound; 'element::body': ElementFound; 'element::br': ElementFound; 'element::button': ElementFound; 'element::canvas': ElementFound; 'element::caption': ElementFound; 'element::center': ElementFound; 'element::cite': ElementFound; 'element::code': ElementFound; 'element::col': ElementFound; 'element::colgroup': ElementFound; 'element::command': ElementFound; 'element::content': ElementFound; 'element::data': ElementFound; 'element::datalist': ElementFound; 'element::dd': ElementFound; 'element::del': ElementFound; 'element::details': ElementFound; 'element::dfn': ElementFound; 'element::dialog': ElementFound; 'element::dir': ElementFound; 'element::div': ElementFound; 'element::dl': ElementFound; 'element::dt': ElementFound; 'element::element': ElementFound; 'element::em': ElementFound; 'element::embed': ElementFound; 'element::fieldset': ElementFound; 'element::figcaption': ElementFound; 'element::figure': ElementFound; 'element::font': ElementFound; 'element::footer': ElementFound; 'element::form': ElementFound; 'element::frame': ElementFound; 'element::frameset': ElementFound; 'element::h1': ElementFound; 'element::h2': ElementFound; 'element::h3': ElementFound; 'element::h4': ElementFound; 'element::h5': ElementFound; 'element::h6': ElementFound; 'element::header': ElementFound; 'element::hgroup': ElementFound; 'element::hr': ElementFound; 'element::html': ElementFound; 'element::i': ElementFound; 'element::iframe': ElementFound; 'element::image': ElementFound; 'element::img': ElementFound; 'element::input': ElementFound; 'element::ins': ElementFound; 'element::isindex': ElementFound; 'element::kbd': ElementFound; 'element::keygen': ElementFound; 'element::label': ElementFound; 'element::legend': ElementFound; 'element::li': ElementFound; 'element::link': ElementFound; 'element::listing': ElementFound; 'element::main': ElementFound; 'element::map': ElementFound; 'element::mark': ElementFound; 'element::marquee': ElementFound; 'element::menu': ElementFound; 'element::menuitem': ElementFound; 'element::meta': ElementFound; 'element::meter': ElementFound; 'element::multicol': ElementFound; 'element::nav': ElementFound; 'element::nextid': ElementFound; 'element::nobr': ElementFound; 'element::noembed': ElementFound; 'element::noframes': ElementFound; 'element::noscript': ElementFound; 'element::object': ElementFound; 'element::ol': ElementFound; 'element::optgroup': ElementFound; 'element::option': ElementFound; 'element::output': ElementFound; 'element::p': ElementFound; 'element::param': ElementFound; 'element::picture': ElementFound; 'element::plaintext': ElementFound; 'element::pre': ElementFound; 'element::progress': ElementFound; 'element::q': ElementFound; 'element::rb': ElementFound; 'element::rp': ElementFound; 'element::rt': ElementFound; 'element::rtc': ElementFound; 'element::ruby': ElementFound; 'element::s': ElementFound; 'element::samp': ElementFound; 'element::script': ElementFound; 'element::section': ElementFound; 'element::select': ElementFound; 'element::shadow': ElementFound; 'element::slot': ElementFound; 'element::small': ElementFound; 'element::source': ElementFound; 'element::spacer': ElementFound; 'element::span': ElementFound; 'element::strike': ElementFound; 'element::strong': ElementFound; 'element::style': ElementFound; 'element::sub': ElementFound; 'element::summary': ElementFound; 'element::sup': ElementFound; 'element::table': ElementFound; 'element::tbody': ElementFound; 'element::td': ElementFound; 'element::template': ElementFound; 'element::textarea': ElementFound; 'element::tfoot': ElementFound; 'element::th': ElementFound; 'element::thead': ElementFound; 'element::time': ElementFound; 'element::title': ElementFound; 'element::tr': ElementFound; 'element::track': ElementFound; 'element::tt': ElementFound; 'element::u': ElementFound; 'element::ul': ElementFound; 'element::var': ElementFound; 'element::video': ElementFound; 'element::wbr': ElementFound; 'element::xmp': ElementFound;};
type ElementFound
type ElementFound = Event & { element: import('@hint/utils-dom').HTMLElement;};
type Endpoint
type Endpoint = string | URL | Target;
type ErrorEvent
type ErrorEvent = Event & { error: Error;};
type Event
type Event = { resource: string;};
type Events
type Events = { 'can-evaluate::script': CanEvaluateScript; 'fetch::end::*': FetchEnd; 'fetch::end::css': FetchEnd; 'fetch::end::font': FetchEnd; 'fetch::end::html': FetchEnd; 'fetch::end::image': FetchEnd; 'fetch::end::json': FetchEnd; 'fetch::end::manifest': FetchEnd; 'fetch::end::script': FetchEnd; 'fetch::end::txt': FetchEnd; 'fetch::end::unknown': FetchEnd; 'fetch::end::xml': FetchEnd; 'fetch::error': FetchError; 'fetch::start': FetchStart; 'fetch::start::target': FetchStart; 'parse::error::*': ErrorEvent; print: PrintEvent; 'scan::end': ScanEnd; 'scan::start': ScanStart; 'traverse::down': TraverseDown; 'traverse::end': TraverseEnd; 'traverse::start': TraverseStart; 'traverse::up': TraverseUp;} & ElementEvents;
type FetchEnd
type FetchEnd = Event & { element: HTMLElement | null; request: Request; response: Response;};
type FetchError
type FetchError = Event & { element: HTMLElement | null; error: any; hops: string[];};
type FetchStart
type FetchStart = Event;
type FormatterOptions
type FormatterOptions = { config?: UserConfig; date?: string; isScanner?: boolean; language?: string; noGenerateFiles?: boolean; output?: string; resources?: HintResources; scanTime?: number; status?: string; target?: string; version?: string;};
type HintMetadata
type HintMetadata = { docs?: MetadataDocs; getDescription: (language: string) => string; getName: (language: string) => string; id: string; ignoredConnectors?: string[]; ignoredUrls?: RegExp[]; schema: any[]; scope: HintScope;};
type HintResources
type HintResources = { connector: IConnectorConstructor | null; formatters: IFormatterConstructor[]; incompatible: string[]; missing: string[]; parsers: IParserConstructor[]; hints: IHintConstructor[];};
type LauncherOptions
type LauncherOptions = { defaultProfile?: boolean; flags?: string[]; port?: number;};
type MetadataDocs
type MetadataDocs = { category?: Category; description: string; name?: string;};
type NetworkData
type NetworkData = { response: Response; request: Request;};
type PrintEvent
type PrintEvent = Event & { problems: Problem[];};
type ReportOptions
type ReportOptions = { attribute?: string; browsers?: string[]; codeSnippet?: string; content?: string; documentation?: ProblemDocumentation[]; element?: HTMLElement | null; location?: ProblemLocation | null; severity: Severity; forceSeverity?: boolean; codeLanguage?: CodeLanguage; fixes?: CodeFix[];};
type Request
type Request = { headers: HttpHeaders; url: string;};
type Resource
type Resource = IConnectorConstructor | IFormatterConstructor | IHintConstructor;
type Response
type Response = { body: ResponseBody; charset: string; headers: HttpHeaders; hops: string[]; mediaType: string; statusCode: number; url: string;};
type ResponseBody
type ResponseBody = { content: string; rawContent: Buffer; rawResponse(): Promise<Buffer>;};
type ScanEnd
type ScanEnd = Event;
type ScanStart
type ScanStart = Event;
type StringKeyOf
type StringKeyOf<T> = Extract<keyof T, string>;
type Target
type Target = { url: string | URL; content?: string;};
type TraverseDown
type TraverseDown = Event & { element: HTMLElement;};
type TraverseEnd
type TraverseEnd = Event & { document: HTMLDocument;};
type TraverseStart
type TraverseStart = Event;
type TraverseUp
type TraverseUp = Event & { element: HTMLElement;};
Package Files (19)
- dist/src/lib/analyzer.d.ts
- dist/src/lib/config.d.ts
- dist/src/lib/engine.d.ts
- dist/src/lib/enums/error-status.d.ts
- dist/src/lib/enums/hint-scope.d.ts
- dist/src/lib/hint-context.d.ts
- dist/src/lib/index.d.ts
- dist/src/lib/types.d.ts
- dist/src/lib/types/analyzer-error.d.ts
- dist/src/lib/types/analyzer.d.ts
- dist/src/lib/types/connector.d.ts
- dist/src/lib/types/element-events.d.ts
- dist/src/lib/types/event.d.ts
- dist/src/lib/types/events.d.ts
- dist/src/lib/types/formatters.d.ts
- dist/src/lib/types/hint-meta.d.ts
- dist/src/lib/types/hints.d.ts
- dist/src/lib/types/network.d.ts
- dist/src/lib/types/parser.d.ts
Dependencies (18)
Dev Dependencies (18)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/hint
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/hint)
- HTML<a href="https://www.jsdocs.io/package/hint"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 5357 ms. - Missing or incorrect documentation? Open an issue for this package.