Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove 'component has been registered but not used' in eslint for Vue.js

I am implementing dynamic components where I use:

<component :is="component_name"></component>

However, eslint keeps returning this:

60:16 error The "component" component has been registered but not used
vue/no-unused-components

How can I disable the rule above on eslint?

like image 515
davidlee Avatar asked Jun 08 '20 09:06

davidlee


1 Answers

You can disable that particular ESLint rule by writing the following at the top of your JavaScript file: /* eslint-disable vue/no-unused-components */. Note that this may be after the first <script> tag in a single-file component (ie. a .vue file).

In your situation, however, you may find it more useful to just disable this error for a particular line by appending the following to the end of the problematic line causing the error: // eslint-disable-line vue/no-unused-components.

like image 95
Lachlan Avatar answered Oct 07 '22 13:10

Lachlan