disallow boolean defaults

  • 🔧 The --fix option on the command line 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>
Now loading...

🔧 Options

  • 'no-default' (default) allows a prop definition object, but enforces that the default property not be defined.
  • 'default-false' enforces that the default can be set but must be set to false.
  "vue/no-boolean-default": ["error", "no-default|default-false"]

🔍 Implementation

Last Updated: 2/3/2019, 2:57:21 AM