知乎论坛htmllint
https://www.zhihu.com/question/21788098/answer/233068540

Htmllint - github
http://htmllint.github.io/

npm
https://www.npmjs.com/

Npm install htmllint
readMe.MD以及下载包中配置文件,可找到百度搜不到的信息,可找到代码来源配置参数的一些使用说明文档等。

webpack + htmllint-loader

附上初始配置参数:
{
“attr-bans”: [
“align”,
“background”,
“bgcolor”,
“border”,
“dynsrc”,
“frameborder”,
“longdesc”,
“lowsrc”,
“onclick”,
“ondblclick”,
“onload”,
“marginwidth”,
“marginheight”,
“scrolling”,
“style”,
“width”,
“height”
],
“attr-name-ignore-regex”: false,
“attr-name-style”: “dash”,
“attr-new-line”: false,
“attr-no-dup”: true,
“attr-no-unsafe-char”: true,
“attr-order”: false,
“attr-quote-style”: “double”,
“attr-req-value”: false,
“attr-validate”: false,
“class-no-dup”: true,
“class-style”: “bem”,
“doctype-first”: false,
“doctype-html5”: false,
“fig-req-figcaption”: true,
“focusable-tabindex-style”: false,
“head-req-title”: true,
“head-valid-content-model”: true,
“href-style”: false,
“html-req-lang”: true,
“html-valid-content-model”: false,
“id-class-ignore-regex”: false,
“id-class-no-ad”: true,
“id-class-style”: “dash”,
“id-no-dup”: true,
“img-req-alt”: “allownull”,
“img-req-src”: false,
“indent-style”: “spaces”,
“indent-width”: 2,
“indent-width-cont”: true,
“input-radio-req-name”: true,
“input-req-label”: false,
“label-req-for”: false,
“lang-style”: “case”,
“line-end-style”: false,
“line-max-len”: false,
“line-max-len-ignore-regex”: “/href/g”,
“maxerr”: false,
“raw-ignore-regex”: false,
“spec-char-escape”: false,
“table-req-caption”: false,
“table-req-header”: false,
“tag-bans”: [
“b”,
“keygen”,
“style”
],
“tag-close”: true,
“tag-name-lowercase”: true,
“tag-name-match”: true,
“tag-self-close”: “always”,
“text-ignore-regex”: false,
“title-max-len”: 80,
“title-no-dup”: true
}

参数配置,不需要使用的参数也要在列表中至false, 否则htmllint会执行默认配置

常用项目配置参数列表:
{
“attr-bans”: [
“dynsrc”,
“frameborder”,
“longdesc”,
“lowsrc”
],
“attr-name-ignore-regex”: false,
“attr-name-style”: false,
“attr-new-line”: false,
“attr-no-dup”: true,
“attr-no-unsafe-char”: false,
“attr-order”: false,
“attr-quote-style”: false,
“attr-req-value”: false,
“attr-validate”: false,
“class-no-dup”: true,
“class-style”: false,
“doctype-first”: false,
“doctype-html5”: false,
“fig-req-figcaption”: false,
“focusable-tabindex-style”: false,
“head-req-title”: true,
“head-valid-content-model”: false,
“href-style”: false,
“html-req-lang”: false,
“html-valid-content-model”: false,
“id-class-ignore-regex”: false,
“id-class-no-ad”: false,
“id-class-style”: false,
“id-no-dup”: true,
“img-req-alt”: false,
“img-req-src”: false,
“indent-style”: false,
“indent-width”: false,
“indent-width-cont”: false,
“input-radio-req-name”: false,
“input-req-label”: false,
“label-req-for”: false,
“lang-style”: false,
“line-end-style”: false,
“line-max-len”: false,
“line-max-len-ignore-regex”: false,
“maxerr”: false,
“raw-ignore-regex”: false,
“spec-char-escape”: false,
“table-req-caption”: false,
“table-req-header”: false,
“tag-bans”: [
],
“tag-close”: true,
“tag-name-lowercase”: true,
“tag-name-match”: true,
“tag-self-close”: “always”,
“text-ignore-regex”: false,
“title-max-len”: 80,
“title-no-dup”: true
}

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐