Skip to content

vue/no-boolean-default

禁止布尔默认值

¥disallow boolean defaults

该规则可防止布尔属性具有默认值。

¥The rule prevents Boolean props from having a default value.

📖 规则详情

该规则是为了强制执行始终将布尔属性默认为 false 的 HTML 标准。

¥The rule is to enforce the HTML standard of always defaulting boolean attributes to false.

Now loading...

🔧选项

¥🔧 Options

  • 'no-default'(默认)允许 prop 定义对象,但强制 default 属性未定义。

    ¥'no-default' (default) allows a prop definition object, but enforces that the default property not be defined.

  • 'default-false' 强制可以设置默认值,但必须设置为 false

    ¥'default-false' enforces that the default can be set but must be set to false.

json
  "vue/no-boolean-default": ["error", "no-default|default-false"]

👫相关规则

¥👫 Related Rules

🚀版本

¥🚀 Version

此规则在 eslint-plugin-vue v7.0.0 中引入

¥This rule was introduced in eslint-plugin-vue v7.0.0

🔍代码实现

¥🔍 Implementation

eslint-plugin-vue v10.0 中文网 - 粤ICP备13048890号