New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

wxmllint

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wxmllint

An unofficial wxml linter.

latest
npmnpm
Version
0.0.7
Version published
Maintainers
1
Created
Source

wxmllint

An unofficial wxml linter and validator.
fork and modified from htmllint

目前可用的rc文件 ./lib/presets/default.js
wxmllint init

TODO

  • "attr-bans"

  • "attr-name-ignore-regex"

  • "attr-name-style" -- camelCase?

  • "attr-new-line" --建议 3

  • "attr-no-dup" --建议 true

  • "attr-no-unsafe-char" --建议 true

  • "attr-order" --建议 ["/^wx/", "/^(?!wx)/"]

  • "attr-quote-style" --建议 "quoted"

  • "attr-req-value" ----建议 false ----booleanAttrs不能满足自定义属性的需求

  • "attr-validate" --建议 true

  • "button-req-content" --建议 false --大量button只是为了open-type

  • "class-no-dup"
    --模板语法不能正确解析 class="{{ a ? 'a' : 'b' }}"
    --配合 "id-class-ignore-regex": "{{.*?}}" 基本可以, 还是有部分class解析不对的情况:

<view class="shop-icon">
     <view class="num {{cartSkuNum < 10 ? '' : cartSkuNum <= 99 ? 'numMiddle' : 'numLarge'}}"></view>
</view>
  • "class-style" --TODO

  • "doctype-first" --建议 false

  • "doctype-html5" -- false

  • "fieldset-contains-legend"

  • "fig-req-figcaption" -- false 小程序不适用

  • "focusable-tabindex-style" -- false

  • "head-req-title" -- false 小程序不适用

  • "head-valid-content-model" -- false 小程序不适用

  • "href-style" -- false

  • "html-req-lang" -- false 小程序不适用

  • "html-valid-content-model" -- false 小程序不适用

  • "id-class-ignore-regex" -- "{{.*?}}" --部分情况似乎有bug, 见 "class-no-dup"

  • "id-class-no-ad" -- false

  • "id-class-style" -- false

  • "id-no-dup" -- true

  • "img-req-alt" -- false

  • "img-req-src" -- true

  • "indent-delta" -- false

  • "indent-style" -- false

  • "indent-width" -- false

  • "indent-width-cont" -- false

  • "input-btn-req-value-or-title" -- true

  • "input-radio-req-name" -- false

  • "input-req-label" -- false

  • "label-no-enc-textarea-or-select" -- true

  • "label-req-for" -- false

  • "lang-style" -- true

  • "line-end-style" -- false

  • "line-max-len" -- ?

  • "line-max-len-ignore-regex"

  • "line-no-trailing-whitespace"

  • "link-min-length-4" -- true --TODO: 考虑mustache

  • "link-req-noopener" -- true 小程序应该不适用

  • "maxerr"

  • "raw-ignore-regex" -- 解析有问题: "/<!-- htmllint ignore -->[^]*?<!-- htmllint unignore -->/"

  • "spec-char-escape" -- false --TODO: mustache

  • "table-req-caption" -- true

  • "table-req-header" -- true

  • "tag-bans" -- image?

  • "tag-close" -- true

  • "tag-name-lowercase" -- false

  • "tag-name-match" -- 统一到 "tag-close"

  • "tag-req-attr" --建议 {"image": [{"name": "src"}]} -- TODO: 实现个 "tag-no-attr" 来禁止 text 上的 class

  • "tag-self-close" -- 统一到 "tag-close"

  • "text-ignore-regex"

  • "title-max-len" -- false 小程序不适用

  • "title-no-dup" -- false 小程序不适用

  • Tokenizer 中识别各处出现的 mustache

wxml 中的 attribs

<view wx:if="{{conditionA}}" {{skuList.length}} bindtap="doSth"></view>

====>
wx:if ---- {{conditionA}}
{{skuList.length}} ---- 
bindtap ---- doSth

Keywords

wxml

FAQs

Package last updated on 25 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts