Skip to content

[FR] inheritAttrs: false when using v-bind="$attrs" #626

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

Closed
privatenumber opened this issue Nov 1, 2018 · 2 comments · Fixed by #1144
Closed

[FR] inheritAttrs: false when using v-bind="$attrs" #626

privatenumber opened this issue Nov 1, 2018 · 2 comments · Fixed by #1144

Comments

@privatenumber
Copy link
Contributor

Components that inherit $attrs into a nested element in the component typically wouldn't want to get duplicated attributes applied to the top-level element. Might be a good linting rule to warn to apply inheritAttrs: false when it detects v-bind="$attrs" being used.

@michalsnik
Copy link
Member

I'm not sure about this rule. It might lead to false-positives, the inheritAttrs might not be explicitly set on the component if it uses a mixin. And having it reporting in one scenario and not in the other seems not very consistent and might actually be misleading in my opinion. WDYT @chrisvfritz ?

@chrisvfritz
Copy link
Contributor

As long as we can avoid false positives (e.g. by just turning the rule off if we detect a mixin or Object.assign/spread on the component object), I think it could be useful. From what I've seen, it's very rare for inheritAttrs: false to come from an external source, so this would still catch 99% of cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants