简体   繁体   中英

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没有未使用的变量错误

when I run "npm run serve" I have this error I use "npm run lint -- --fix" but nothing change

LoginPage.vue 登录页面-1

登录页面-2

eslintrc.js

eslintrc.js

It literally tells you what the problem is

Don't remove unused var checks in eslint, thats just lazy.

It sees two problems with your code:

  1. You are using composition API, yet you have not included setup in your script tag. Your script opening tag should look like <script setup> this. Ref: docs
  2. Your show function doesn't use icon variable. So it should be removed since it creates unnecessary noise in the code.

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM