Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

banno-htmlhint

banno793MIT0.9.15

A Static Code Analysis Tool for HTML

html, hint, Analysis, Javascript

readme

HTMLHint

HTMLHint logo

HTMLHint is a Static Code Analysis Tool for HTML, you can use it with IDE or in build system.

Build Status Coverage Status NPM version License NPM count NPM count

Official Site: http://htmlhint.com/

Quick start

  1. install & hint

     npm install htmlhint -g
     htmlhint -V
     htmlhint --help
     htmlhint www
     htmlhint www/test.html
     htmlhint www/**/*.xhtml
     htmlhint www/**/*.{htm,html}
     htmlhint http://www.alibaba.com/
     cat test.html | htmlhint stdin
  2. results

        test.html
           L5 |    </head>
                   ^ <title> must be present in <head> tag. (title-require)
           L8 |    </body>
                   ^ Tag must be paired, missing: [ </div> ], start tag match failed [ <div> ] on line 7. (tag-pair)
    
     2 errors in 1 files
  3. config rules

    search .htmlhintrc file in current directory and all parent directories:

     htmlhint
     htmlhint test.html

    custom config file:

     htmlhint --config htmlhint.conf test.html

    custom rules:

     htmlhint --rules tag-pair,id-class-value=underline test.html

    Inline rules in test.html:

     <!--htmlhint tag-pair,id-class-value:underline -->
     <html>
     <head>
         ...

Guide

  1. How to use
  2. All Rules
  3. How to Develop

License

HTMLHint is released under the MIT license:

The MIT License

Copyright (c) 2014-2016 Yanis Wang < yanis.wang@gmail.com >

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Thanks

changelog

HTMLHint change log

ver 0.9.14 (2016-5-2)

add:

  1. cli: support hint for url
  2. attr-lowercase: add test case

ver 0.9.13 (2016-5-1)

add:

  1. change cli parameter: --plugin to --rulesdir
  2. add formatter directory support
  3. add formatters: compact, markdown
  4. add cli parameter:--nocolor, disable color in cli
  5. space-tab-mixed-disabled plugin: add space length require
  6. add empty elements: track,command,source,keygen,wbr
  7. add hint stdin for cli

fix:

  1. report error evidence if tag attrs include \r\n
  2. space-tab-mixed-disabled issue #119
  3. attr name support all w3c defined characters

improve:

  1. Parse inline ruleset after default ruleset

ver 0.9.10 (2015-10-12)

add:

  1. attr-unsafe-chars(rule): show unsafe code in message
  2. support glob pattern for cli
  3. support format as custom: json, junit, checkstyle
  4. support plugin: htmlhint --plugin ./plugins/
  5. add rule: inline-style-disabled
  6. add rule: inline-script-disabled

fix:

  1. title-require(rule): report error when <html><title>test</title><head></head><body></body></html>
  2. title-require(rule): report error when <html><head><title></title></head><body></body></html>

ver 0.9.9 (2015-10-9)

add:

  1. add config loaded message to cli log
  2. support async for cli

fix:

  1. close issue: #79, fix exit with 0 when hint errors
  2. fix end event col
  3. attr-unsafe-chars(rule): exclude \r\n

ver 0.9.8 (2015-10-7)

add:

  1. Search .htmlhintrc in parent directory
  2. Allow comments in json
  3. Support hint any file without .html or .htm extension, just like: htmlhint test.xhtml
  4. Support json raw format in cli
  5. tag-pair(rule): Show the line of the start tag
  6. space-tab-mixed-disabled(rule): Support space and tab mode, for check only space or tab
  7. Make cli logs more clear to people
  8. add rule: title-require, <title> must be present in <head> tag.

fix:

  1. Fix issue: #77 <link rel=icon><link rel=icon>
  2. Made the descriptions and error messages of rules more clear to people
  3. head-script-disabled(fule): No head not result error

ver 0.9.7 (2015-3-8)

fix:

  1. fix 'No such file' issue on mac
  2. head-script-disabled: not match template script

ver 0.9.6 (2014-6-18)

add:

  1. add rule: attr-no-duplication
  2. add rule: space-tab-mixed-disabled
  3. add rule: id-class-ad-disabled
  4. add rule: href-abs-or-rel
  5. add rule: attr-unsafe-chars
  6. add default rule: attr-no-duplication
  7. add inline ruleset support
  8. add test spec: Set false to rule
  9. add point: load default ruleset when use empty ruleset

ver 0.9.4 (2013-9-27)

  1. add rule: src-not-empty

fix:

  1. fix attr-value-double-quotes rule: <img src=''> should result error

ver 0.9.3 (2013-5-24)

add:

  1. add ruleid to csslint message

fix:

  1. fix csslint rule: del undefined of raw
  2. fix parser for: <div class="foo""><a><span">

ver 0.9.2 (2013-4-6)

add:

  1. add rule: csslint
  2. add rule: jshint
  3. add rule: id-unique
  4. add cli

fix:

  1. compatible with:

     <div class="foo"
     <div class"foo">
     <div class=foo">
     <div class="foo>

ver 0.9.1 (2013-3-23)

add:

  1. add rule: attr-lowercase
  2. add rule: attr-value-double-quotes
  3. add rule: attr-value-not-empty
  4. add rule: doctype-first
  5. add rule: doctype-html5
  6. add rule: head-script-disabled
  7. add rule: id-class-value
  8. add rule: img-alt-require
  9. add rule: spec-char-escape
  10. add rule: style-disabled
  11. add rule: tagname-lowercase
  12. add rule: tag-pair
  13. add rule: tag-self-close