# wxml/no-unexpected-string-bool
# Background
boolean in data binding
Keywords (must be enclosed in double quotes)
True
: Boolean-type true.false
: Boolean-type false.
<checkbox checked="{{false}}"> </checkbox>
Note: Do not directly write checked="false"
. Its computing result is a string which represents a true value when converted to a Boolean value.
# Motivation
This rule enforce developer avoid using wrong boolean
in wxml data binding
<!-- ✓ GOOD -->
<checkbox checked="{{false}}"> </checkbox>
<popup showMask />
<!-- ✗ BAD -->
<checkbox checked="false"> </checkbox>
<popup showMask="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/no-unexpected-string-bool": "error" }
# Version
This rule was introduced in eslint-plugin-wxml v0.2.1