codercup / unibest

unibest - 最好用的 uniapp 开发框架。unibest 是由 uniapp + Vue3 + Ts + Vite4 + UnoCss + UniUI 驱动的跨端快速启动模板,使用 VS Code 开发,具有代码提示、自动格式化、统一配置、代码片段等功能,同时内置了大量平时开发常用的基本组件,开箱即用,让你编写 uniapp 拥有 best 体验。
https://codercup.github.io/unibest-docs/
MIT License
1.68k stars 200 forks source link

在组件中使用enum枚举会报错:xxx is defined but never used. eslintno-unused-vars #6

Closed dhanweb closed 7 months ago

dhanweb commented 7 months ago

解决方案之一是在.eslintrc.cjs中的rules字段添加 'no-unused-vars': 'off', 暂时未发现会影响其他功能

codercup commented 7 months ago

你这个配置也太暴力了吧,我后面看下。

codercup commented 7 months ago

方便截个图吗?我看看你怎么用的

dhanweb commented 7 months ago

图一是我的配置项,图二是加上去之后还是能够正确检测未使用的类型或者变量 原贴链接:https://stackoverflow.com/questions/57802057/eslint-configuring-no-unused-vars-for-typescript PixPin_2024-03-01_14-05-46 PixPin_2024-03-01_14-06-34

codercup commented 7 months ago

type test = {} 这个代码是在什么文件里面的?

codercup commented 7 months ago

要不你加群吧,在群里说比较方便

codercup commented 7 months ago

image

dhanweb commented 7 months ago

type test = {} 这个代码是在什么文件里面的?

在.vue文件和.ts文件都会报这个错误的,加上我说的才能通过eslint校验

codercup commented 7 months ago

type test = {} 这个代码是在什么文件里面的?

在.vue文件和.ts文件都会报这个错误的,加上我说的才能通过eslint校验

因为你没使用啊。

codercup commented 7 months ago

image 代码已经推了

codercup commented 7 months ago

fixed