Skip to content

Update: improve warnings about key on template elements #45

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

Merged
merged 3 commits into from
Jun 30, 2017
Merged

Conversation

mysticatea
Copy link
Member

Fixes #43.

This PR does 2 things.

  1. Fixes no-invalid-v-for and require-v-for-key rules to check whether child elements of <template> elements have v-bind:key attribute. [semver-minor]
  2. Add new no-template-key rule to disallow key attribute on <template> elements. I think that no-template-key rule should be recommended, however I set recommended: false for now because semver policy of ESLint needs a major version to update the recommended config. [semver-minor]


This rule reports the `<template>` elements which have `key` attribute.

👎 Examples of **incorrect** code for this rule:
Copy link
Member

Choose a reason for hiding this comment

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

I think GitHub emoji code (e.g. :tada:) is maintainaceble(read/write) than emoji binary code. 👀

Copy link
Member

Choose a reason for hiding this comment

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

Agree with @kazupon, I did so while importing elint-plugin-vue-trial too

Copy link
Member Author

@mysticatea mysticatea Jun 22, 2017

Choose a reason for hiding this comment

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

In my custom, I don't use the notation since it doesn't work outside of GitHub (i.g. document generators, editor previews, etc...). Should I use it?

@mysticatea
Copy link
Member Author

I solved merge conflicts.

Copy link
Member

@michalsnik michalsnik left a comment

Choose a reason for hiding this comment

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

Looks good @mysticatea However I don't quite get why the key on template is considered harmful, could you please explain this a little bit? Reason behind this in rule's documentation would also be helpful for others I think.

@armano2
Copy link
Contributor

armano2 commented Jun 29, 2017

thats why: #43
<template> cannot be keyed. Place the key on real elements instead.

@michalsnik michalsnik merged commit 866d057 into master Jun 30, 2017
@michalsnik michalsnik deleted the issue43 branch June 30, 2017 08:36
armano2 pushed a commit to armano2/eslint-plugin-vue that referenced this pull request Jul 13, 2017
* Update: add check for `key` attribute of child of templates (refs vuejs#43)

* New: no-template-key (fixes vuejs#43)

* replace emoji by github notation
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.

4 participants