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

No-unused-components reporting incorrectly #571

Closed
half2me opened this issue Sep 13, 2018 · 10 comments
Closed

No-unused-components reporting incorrectly #571

half2me opened this issue Sep 13, 2018 · 10 comments

Comments

@half2me
Copy link

half2me commented Sep 13, 2018

I use the following component: https://github.com/crowdbotics/v-img

I have this:

<template>
  <img v-img src="">
</template>
import VueImg from 'v-img';
...
components: {
  ...
  VueImg,
},

When I run eslint I get the following error:
error The "VueImg" component has been registered but not used vue/no-unused-components

I'm guessing this is probably because the component is not instantiated directly, but rather just attached to the <img> tag.

I'm using ^5.0.0-beta.3

@half2me
Copy link
Author

half2me commented Sep 13, 2018

possible duplicate of #556

@Justineo
Copy link
Member

It seems that v-img is a directive, not a component. Are you registering it correctly?

@michalsnik
Copy link
Member

According to this plugins' documentation you don't have to register any component, but only the plugin and let it do the job (it will register v-img directive for you). VueImg is a plugin, not component, so you do it like this:

import Vue from 'vue';
import VueImg from 'v-img';

Vue.use(VueImg);

@half2me
Copy link
Author

half2me commented Sep 14, 2018

@michalsnik but if I don't want to register it globally, but just for a single component?

@alex-shamshurin
Copy link

I still have the same issue

@half2me
Copy link
Author

half2me commented Nov 6, 2018

It should probably be put in directives: {VueImg} instead

@trajche18
Copy link

Hi @michalsnik and others, have you found a solution regarding this issue? I am experiencing the same.

import VButton from '@/components/common/VButton'
import VCombobox from '@/components/common/VCombobox'
import VCheckbox from '@/components/common/VCheckbox'

components: { VButton, VCombobox, VCheckbox }

The first two components get recognized with no problem. When it comes to VCheckbox, I get: component registered, but not used?

Looking forward to hearing from you. Cheers

@armano2
Copy link
Contributor

armano2 commented Mar 5, 2019

@trajche18 Are you using it in template?

@trajche18
Copy link

@trajche18 Are you using it in template?

Hi @armano2, I certainly am.

import VCheckbox from '@/components/common/VCheckbox.vue'

.add('ARIA Checkbox', () => ({
components: { VCheckbox },
template:
'<v-stats-card :items="items" label="I agree to the Terms and Conditions" ' +
':rules="[v => !!v || \'You must agree with the terms and conditions in order to continue.\']" ' +
'arialabel="You must agree with the terms." ' +
'@click="onClicked(\'checkbox clicked\')" />',
methods
}))

@trajche18
Copy link

Any updates on this @armano2 and other collaborators?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants