# wxml/omit-bool-attributes
# Backgroud
In wxml (opens new window), when we use boolean attriute like <a attr=true />
, we can omit it and convert to <a sttr />
just like jsx (opens new window).
# Motivation
Force developer omit true
attributes for better coding style and save miniprogram bundle size.
<!-- ✓ GOOD -->
<cart showBadge />
<swiper autoplay />
<virtual-list hideSpinner="{{false}}" />
<!-- ✗ BAD -->
<cart showBadge="{{true}}" />
<swiper autoplay="{{true}}" />
💡 tips
You can edit code via online editor, it's online REPL, try to fix eslint problem !
# Config
No special options, normal config is ok
{ "wxml/omit-bool-attributes": "error" }
# Version
This rule was introduced in eslint-plugin-wxml v0.7.1