eslint-plugin-vue-scoped-css icon indicating copy to clipboard operation
eslint-plugin-vue-scoped-css copied to clipboard

Support router-link, nuxt-link and the like

Open DragonWhisperer opened this issue 4 years ago • 4 comments

For example:

<template>
  <nuxt-link :to="`#`">button</nuxt-link>
</template>

<style scoped>
a {
  color: red;
}
</style>

nuxt-link is converted to a tag, but I get error: The selector `a` is unused. Please support.

Maybe something like this in the settings:

'vue-scoped-css/no-unused-selector': ['warn', {
  'equalTags': {
    'nuxt-link': 'a',
    'n-link': 'a',
    'NuxtLink': 'a',
    'NLink': 'a',
    'router-link': 'a'
  },
}]

DragonWhisperer avatar Oct 08 '20 11:10 DragonWhisperer

Whether <nuxt-link> has an a tag depends on the implementation, so I think you need to give it a new class.

<template>
  <nuxt-link class="foo" :to="`#`">button</nuxt-link>
</template>

<style scoped>
.foo {
  color: red;
}
</style>

So I don't want to add that option.

ota-meshi avatar Oct 19 '20 03:10 ota-meshi

It’s maybe a better css design, but still, as you said it depends on the implementation so it makes sense to enable it as a custom option.

DragonWhisperer avatar Oct 19 '20 10:10 DragonWhisperer

What about <router-link tag="xy">? This should be clear which tag it's using.

wolfgangwalther avatar Jan 12 '21 11:01 wolfgangwalther

Any updates on this?

KnifeFed avatar Dec 09 '22 08:12 KnifeFed