# wxml/forbid-attributes
# Motivation
Forbid using some attributes. For example: jsx use className
but wxml use class
as class name. So we can hint developer to chose right attribute when migrate from react project to wechat miniprogram.
// following code use this config
{
"wxml/forbid-attributes": [
"error",
{
"forbid":
[
{
"attr": "className",
"message": "wxml use class not jsx className"
}
]
}
]
}
<!-- ✓ GOOD -->
<text class="text-center" >{{name}}</div>
<!-- ✗ BAD -->
<text className="text-center" >{{name}}</div>
<text fuck="true" >{{name}}</div>
💡 tips
You can edit code via online editor, it's online REPL, try to fix eslint problem !
# Config
"wxml/forbid-attributes": [<enabled>, { "forbid": [<string|{ attr: string, message: string }>] }]
# Version
This rule was introduced in eslint-plugin-wxml v0.7.3