简体   繁体   English

Eslint with Vue 给出 function 已定义但从未使用过 no-unused-vars

[英]Eslint with Vue gives function is defined but never used no-unused-vars

Is there a way to fix this error in vue.js ( vue3 ) before this error I have errors about prettier有没有办法在这个错误之前修复 vue.js ( vue3 ) 中的这个错误我有关于 prettier 的错误没有未使用的变量错误

when I run "npm run serve" I have this error I use "npm run lint -- --fix" but nothing change当我运行“npm run serve”时出现此错误我使用“npm run lint -- --fix”但没有任何改变

LoginPage.vue登录页面.vue 登录页面-1

登录页面-2

eslintrc.js eslintrc.js

eslintrc.js

It literally tells you what the problem is它从字面上告诉你问题是什么

Don't remove unused var checks in eslint, thats just lazy.不要在 eslint 中删除未使用的 var 检查,那只是懒惰。

It sees two problems with your code:它发现您的代码存在两个问题:

  1. You are using composition API, yet you have not included setup in your script tag.您正在使用组合 API,但您尚未在脚本标记中包含设置。 Your script opening tag should look like <script setup> this.您的脚本开始标记应该类似于<script setup>这个。 Ref: docs参考:文档
  2. Your show function doesn't use icon variable.您的节目 function 不使用图标变量。 So it should be removed since it creates unnecessary noise in the code.所以它应该被删除,因为它会在代码中产生不必要的噪音。

Hope this helps希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 定义了“ stringValues”,但从未使用过no-unused-vars - “stringValues” is defined but never used no-unused-vars 定义了“标头”,但从未使用过未使用的变量 - 'Header' is defined but never used no-unused-vars &#39;Home&#39; 已定义但从未使用 no-unused-vars&quot;.* - 'Home' is defined but never used no-unused-vars".* @typescript-eslint/eslint-plugin 错误:定义了“路由”但从未使用过(no-unused-vars) - @typescript-eslint/eslint-plugin error: 'Route' is defined but never used (no-unused-vars) &#39;UserInput&#39; 已定义但从未使用过 no-unused-vars &#39;UserOutput&#39; 已定义但从未使用过 no-unused-vars - 'UserInput' is defined but never used no-unused-vars 'UserOutput' is defined but never used no-unused-vars ESLint 抱怨从未使用过本地 state 变量 no-unused-vars - ESLint complains that a local state variable is never used no-unused-vars 组件已定义但从未使用 reactjs 中的 no-unused-vars 错误警告 - component is defined but never used no-unused-vars error warning in reactjs 带有 React 的 ESLint 给出了 `no-unused-vars` 错误 - ESLint with React gives `no-unused-vars` errors 递归箭头 function 中的 ESlint“no-unused-vars” - ESlint "no-unused-vars" in recursive arrow function Vue.js 错误“app' is assigned a value but never used no-unused-vars - Vue.js error "app' is assigned a value but never used no-unused-vars
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM