How to use the hint/dist/src/lib/engine.Engine function in hint

To help you get started, we’ve selected a few hint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webhintio / hint / packages / extension-browser / src / content-script / webhint.ts View on Github external
const resources: HintResources = {
        connector: WebExtensionConnector,
        formatters: [WebExtensionFormatter],
        hints: enabledHints,
        incompatible: [],
        missing: [],
        parsers: [
            CSSParser as any,
            HTMLParser as any,
            JavaScriptParser as any,
            ManifestParser as any
        ]
    };

    const engine = new Engine(config, resources);
    const problems = await engine.executeOn(new URL(location.href));

    const filteredProblems = problems.filter((problem) => {
        return problem.severity >= (userConfig.severityThreshold || Severity.warning);
    });

    engine.formatters.forEach((formatter) => {
        formatter.format(filteredProblems, {
            resources,
            target: location.href
        });
    });
};