微信小程序 eslint 插件 eslint-plugin-wxml v0.4.1 发布
eslint-plugin-wxml
微信小程序eslint插件 eslint-plugin-wxml 于2021年11月5日发布了新版v0.4.1
1. 新增了规则 wxml/no-wx-if-string,用于校验警告在使用wx:if/wx:elif时必须使用有效的布尔值插值,否则会产生预期之外的结果
<view wx:if="{{user}}"> {{user.name}}</view>If you use wx:if/wx:elif as control flow, make sure wx:if/wx:elif's value is a boolean, not a string (or dynamic string), otherwise the value will always be true, your code logic will be broken.
wx:if="{{show}} " => wx:if="true " => true
wx:if="{{show}} " => wx:if="false " => true
wx:if="{{show}}-s" => wx:if="true-s" => true
wx:if="{{show}}-s" => wx:if="false-s" => true
eslint插件使用示例:
官方文档地址: https://eslint-plugin-wxml.js.org
相关代码变更详见 https://github.com/wxmlfile/eslint-plugin-wxml/compare/v0.4.0...v0.4.1

