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

⭐️New: Add rule no-duplicate-attr-inheritance #627

Closed

Conversation

privatenumber
Copy link
Contributor

@privatenumber privatenumber commented Nov 2, 2018

This rule makes sure you're setting inheritAttrs to false when it detects v-bind="$attrs".

This rule is to prevent duplicated attribute inheritance: http://jsfiddle.net/hirokiosame/h0j3qrbm/

Can update the docs if there's consensus on the rule proposal.

@armano2
Copy link
Collaborator

armano2 commented Nov 3, 2018

ticket: #626

Copy link
Collaborator

@armano2 armano2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What we should do with mixins and extend? property can be set inside them.

lib/rules/no-duplicate-attr-inheritance.js Outdated Show resolved Hide resolved
Co-Authored-By: hirokiosame <hiroki.osame@gmail.com>
@privatenumber
Copy link
Contributor Author

@armano2
What do you think of the following behavior?

  • If it detects a mixin being pulled in, the rule gives the user the benefit of the doubt that inheritAttrs: false is set via the mixin. We can either emit a warning instead of an error, or emit no error at all.
  • If the component is extended upon, then the base should be responsible for having inheritAttrs: false IMO. It shouldn't be the extending component's responsibility to patch a bug in the base component.

@michalsnik
Copy link
Member

Thanks for working on it @hirokiosame , however I'm going to close this PR for the moment, until we decide whether it's something we want to consider. Let's continue discussion in the relevant issue: #626

ota-meshi added a commit that referenced this pull request May 20, 2020
* Added no-duplicate-attr-inheritence rule

* New rule no-duplicate-attr-inheritance

* New rule no-duplicate-attr-inheritance

* Code to work with Node v6.14.4

* Remove category

Co-Authored-By: hirokiosame <hiroki.osame@gmail.com>

* Update

Co-authored-by: Hiroki Osame <hiroki@weebly.com>
Co-authored-by: Armano <armano2@users.noreply.github.com>
Co-authored-by: hirokiosame <hiroki.osame@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants