Skip to content

Latest commit

 

History

History
61 lines (44 loc) · 1.55 KB

no-boolean-default.md

File metadata and controls

61 lines (44 loc) · 1.55 KB
pageClass sidebarDepth title description since
rule-details
0
vue/no-boolean-default
disallow boolean defaults
v7.0.0

vue/no-boolean-default

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>

🔧 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"]

👫 Related Rules

🚀 Version

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

🔍 Implementation