# vue/no-boolean-default
disallow boolean defaults
- 🔧 The
--fix
option on the command line (opens new window) can automatically fix some of the problems reported by this rule.
The rule prevents Boolean props from having a default value.
# 📖 Rule Details
The rule is to enforce the HTML standard of always defaulting boolean attributes to false.
<script>
export default {
props: {
foo: {
type: Boolean,
default: true
},
bar: {
type: Boolean
}
}
}
</script>
# 🔧 Options
'no-default'
(default) allows a prop definition object, but enforces that thedefault
property not be defined.'default-false'
enforces that the default can be set but must be set tofalse
.
"vue/no-boolean-default": ["error", "no-default|default-false"]
# 👫 Related Rules
# 🚀 Version
This rule was introduced in eslint-plugin-vue v7.0.0