前端 - 代码检查htmllint

知乎论坛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
}

猜你喜欢

转载自blog.csdn.net/weixin_42284354/article/details/80815004
今日推荐