Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
andreww2012 opened this issue Nov 4, 2024 · 0 comments · May be fixed by #2598
Open
2 tasks done

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

andreww2012 opened this issue Nov 4, 2024 · 0 comments · May be fixed by #2598

Comments

@andreww2012
Copy link

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

@waynzh waynzh linked a pull request Nov 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant