JS.VUE.NO.DUPLICATE.ATTR.INHERITANCE

Enforce 'inheritAttrs' to be set to 'false' when using 'v-bind="$attrs"'

vue/no-duplicate-attr-inheritance

enforce inheritAttrs to be set to false when using v-bind="$attrs"

Rule Details

This rule aims to prevent duplicated attribute inheritance.
This rule to warn to apply inheritAttrs: false when it detects v-bind="$attrs" being used.

{'vue/no-duplicate-attr-inheritance': ['error']}

Copy
<template>
  <MyInput v-bind="$attrs" />
</template>
<script>
export default {
  /* GOOD */
  inheritAttrs: false
}

{'vue/no-duplicate-attr-inheritance': ['error']}

Copy
<template>
  <MyInput v-bind="$attrs" />
</template>
<script>
export default {
  /* BAD */
  // inheritAttrs: true (default)
}

Options

Nothing.

Further Reading

  • API - inheritAttrs (https://v3.vuejs.org/api/options-misc.html#inheritattrs)

The content on this page is adapted from the ESLint User Guide. Copyright © OpenJS Foundation and other contributors, www.openjsf.org. All rights reserved. https://eslint.org/docs/rules/