Vue solves the error: error The “xxxxx” component has been registered but not used

error The “xxxxx” component has been registered but not used(vue/no-unused-components)

  • Translated as "xxxxx" component has been registered but not used.
    insert image description here
    Reason for error : The eslint syntax specification is used in the Vue project

Solution 1: Delete the reference of the component, that is, the unused components are not referenced

Solution 2: Use the annotations provided by eslint

  • Add comments before referencing components, eslint will ignore the Warning of the next line or ignore the Warning of the entire file

insert image description here

 // eslint-disable-next-line  // 忽略下一行 Warning
 /* eslint-disable */         // 忽略整个文件 Warning

Solution 3: package.jsonAdd a new code block in , and the project needs to be recompiled after saving

"rules": {
    
    
    "generator-star-spacing": "off",
    "no-tabs":"off",
    "no-unused-vars":"off",
    "no-console":"off",
    "no-irregular-whitespace":"off",
    "no-debugger": "off"
},

Guess you like

Origin blog.csdn.net/Kinrun/article/details/126744362