vuejs / eslint-plugin-vue

Official ESLint plugin for Vue.js
https://eslint.vuejs.org/
MIT License
4.47k stars 667 forks source link

`no-duplicate-attr-inheritance`: should ignore components with multiple root nodes? #2596

Open andreww2012 opened 2 weeks ago

andreww2012 commented 2 weeks ago

Checklist

Tell us about your environment

Please show your full configuration:

What did you do?

If a component has multiple root nodes, Vue encourages the presence of v-bind="$attrs" because essentially inheritAttrs is implicitly set to false. I suggest that this rule ignores such components as setting inheritAttrs: false manually becomes redundant. Or perhaps have an option to ignore or not ignore for the sake of explicitness?

Example of SFCs that shouldn't be reported:

<template>
  <div v-bind="$attrs"></div>
  Some text
</template>

<template>
  <div v-bind="$attrs"></div>
  <div>Another div</div>
</template>

Test on the rule page

What did you expect to happen?

What actually happened?

Repository to reproduce this issue