JSPM

  • Created
  • Published
  • Downloads 23376
  • Score
    100M100P100Q139266F
  • License Apache-2.0

webhint parser needed to analyze HTML files

Package Exports

  • @hint/parser-html

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@hint/parser-html) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

HTML parser (@hint/parser-html)

The HTML parser is built on top of jsdom so hints can analyze HTML files.

Note: This parser is currently only needed if using the local connector. Other connectors provide their own DOM to generate events instead.

To use it you will have to install it via npm:

npm install @hint/parser-html

Note: You can make npm install it as a devDependency using the --save-dev parameter, or to install it globally, you can use the -g parameter. For other options see npm's documentation.

And then activate it via the .hintrc configuration file:

{
    "connector": {...},
    "formatters": [...],
    "hints": {
        ...
    },
    "parsers": ["html"],
    ...
}

Events emitted

This parser emits the event parse::html of type HTMLParse which has the following information:

  • window: an IAsyncWindow object containing the parsed document.
  • html: a string containing the raw HTML source code.
  • resource: the parsed resource.

This parser also automatically traverses and emits events for elements in the tree (see events for details):

  • element::<element-type>
  • traverse::down
  • traverse::end
  • traverse::start
  • traverse::up