Skip to content

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

Closed
@andreww2012

Description

@andreww2012

Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have read the FAQ and my problem is not listed.

Tell us about your environment

  • ESLint version: 9.13.0
  • eslint-plugin-vue version: 9.30.3
  • Vue version: 3.5.12
  • Node version:
  • Operating System:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions