html-validate-angular

5.1.0 • Public • Published

html-validate-angular

pipeline status coverage report

Angular (2.x and later) and AngularJS (1.x) support for html-validate.

  • Extracts templates from components and routes with inline templates.
  • Angular 2.x or later: Transforms property and attribute bindings in HTML.
  • Angular 1.x: Transforms interpolated attributes (including ng-attr-*) in HTML.
  • Handles dynamic bindings for rules checking presence of text.

Typescript is not yet supported. Help wanted

Example

export const FooComponent = {
  template: "<button>foo</button>",
};
export function routeConfig($routeProvider) {
  $routeProvider.when("/route", { template: "<p>foo</i>" });
}

In both cases it will allow html-validate to parse and detect errors in the templates:

component.js
  2:13  error  Button is missing type attribute  button-type

route.js
  2:51  error  Mismatched close-tag, expected '</p>' but found '</i>'  close-order

Usage

npm install --save-dev html-validate-angular

In .htmlvalidate.json:

{
  "transform": {
    "^.*\\.js$": "html-validate-angular/js",
    "^.*\\.html$": "html-validate-angular/html"
  }
}

HTML processing is optional but is needed when attribute interpolation is used.

Package Sidebar

Install

npm i html-validate-angular

Weekly Downloads

96

Version

5.1.0

License

MIT

Unpacked Size

14.9 kB

Total Files

22

Last publish

Collaborators

  • ext