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

Rule Proposal: vue/no-deprecated-router-link-tag-prop #1306

Open
manniL opened this issue Sep 21, 2020 · 2 comments
Open

Rule Proposal: vue/no-deprecated-router-link-tag-prop #1306

manniL opened this issue Sep 21, 2020 · 2 comments

Comments

@manniL
Copy link
Contributor

@manniL manniL commented Sep 21, 2020

Please describe what the rule should do:

Using the tag property for RouterLink or NuxtLink is usually a bad idea because it removes out-of-the-box accessibility (further: vuejs/vue-router-next#148 (comment)). This rule should throw an error if people try to change the tag.

PS: The tag prop will be removed in future majors of vue-router.

What category should the rule belong to?

[ ] Enforces code style (layout)
[x] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

<template>
 <RouterLink tag="div" to="/">Home</RouterLink>
</template>
<template>
 <RouterLink :tag="someVariable" to="/">Home</RouterLink>
</template>
<template>
 <NuxtLink tag="div" to="/">Home</NuxtLink>
</template>
@ota-meshi
Copy link
Member

@ota-meshi ota-meshi commented Sep 27, 2020

Thank you for suggesting the rule.
That sounds good to me.

However, rules that disallow deprecated features has no-deprecated, so I think a rule name like no-deprecated-router-link-tag-prop is good.

I think the documentation for this rule should include a link to the RFC.
https://github.com/vuejs/rfcs/blob/master/active-rfcs/0021-router-link-scoped-slot.md
Also, I think that good to include a hint to use custom prop and v-slot in the rule warning message.

The rule checks only the RouterLink component by default. Rule options allow users to add more components they want to check. Users can also use this option to check the NuxtLink component.

@manniL manniL changed the title Rule Proposal: vue/router-link-no-custom-tag Rule Proposal: vue/no-deprecated-router-link-tag-prop Sep 27, 2020
@manniL
Copy link
Contributor Author

@manniL manniL commented Sep 27, 2020

Thanks for the feedback! I've changed the name accordingly 😋

@ota-meshi ota-meshi removed the help wanted label Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.