Skip to content

Files

Latest commit

 

History

History
39 lines (29 loc) · 819 Bytes

no-boolean-default.md

File metadata and controls

39 lines (29 loc) · 819 Bytes

Pattern: Use of boolean default

Issue: -

Description

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 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"]
```.

## Further Reading

* [eslint-plugin-vue - no-boolean-default](https://eslint.vuejs.org/rules/no-boolean-default.html)