If you install the vuejs eslint plugin and configure it to use the "strongly-recommended" ruleset, the linter will tell you to change the following code:
<router-link class="my-link" :to="{ name: 'index' }">Home</router-link>
into this
<router-link
class="my-link"
:to="{ name: 'index' }"
>
Home
</router-link>
The problem is that when you do this, your <a>
tag renders with a newline inside of the text causing the styling to look strange with an underline under nothing.
This is the rule that causes the problem and you can definitely get around it by using configuration options and telling the rule to ignore <router-link>
elements but then you end up with code styled just as strangely since other rules require the attributes to be on new lines:
<router-link
class="my-link"
:to="{ name: 'index' }"
>Home</router-link>
Has anyone encountered this before? Is there a way to just trim text inside anchor tags? Am I missing something with the Vue Router configuration or ESLint configuration?
Here is a link to an example: