JSPM

html-validate

1.3.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 172474
  • Score
    100M100P100Q157892F
  • License MIT

html linter

Package Exports

  • html-validate
  • html-validate/build/cli/formatter
  • html-validate/build/config
  • html-validate/build/config/default
  • html-validate/build/dom
  • html-validate/build/formatters/codeframe
  • html-validate/build/formatters/stylish
  • html-validate/build/htmlvalidate
  • html-validate/build/matchers
  • html-validate/build/meta
  • html-validate/build/parser
  • html-validate/build/reporter
  • html-validate/elements/html5.json

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 (html-validate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

html-validate

pipeline status coverage report

Offline HTML5 validator. Validates either a full document or a smaller (incomplete) template, e.g. from an AngularJS or React component.

Features

  • Can test fragments of HTML, for instance a component template.
  • Does not upload any data to a remote server, all testing is done locally.
  • Strict and non-forgiving parsing. It will not try to correct any incorrect markup or guess what it should do.

Usage

npm install -g html-validate
html-validate FILENAME..

Configuration

Create .htmlvalidate.json:

{
  "extends": [
    "htmlvalidate:recommended"
  ],

  "rules": {
    "close-order": "error"
    "void": ["warn", {"style": "omit"}]
  }
}

Example

<p>
  <button>Click me!</button>
  <div id="show-me">
    Lorem ipsum
  </div>
</p>
  1:1  error  Element <p> is implicitly closed by adjacent <div>  no-implicit-close
  2:2  error  Button is missing type attribute                    button-type
  6:4  error  Unexpected close-tag, expected opening tag          close-order

Test

Testing is done using jest.

npm test

or call jest directly.

Some tests are autogenerated from documentation examples, use grunt docs to build those before running.

Lint

Linting is done using eslint.

npm run lint

or call eslint or tslint directly.

Build

npm run build

To build documentation use:

npm run build:docs

The documentation can be served locally using:

npm start