ESlint报错[vue/comment-directive]cleareslint-plugin-vue及Cannot find name ‘template‘.

项目背景:项目是用vite脚手架创建的vue3项目

问题:新建了一个vue文件,在页面的第一行和最后一行都报错

ESlint报错[vue/comment-directive]cleareslint-plugin-vue及Cannot find name ‘template‘.

ESlint报错[vue/comment-directive]cleareslint-plugin-vue及Cannot find name ‘template‘.

报错信息:

    Cannot find name ‘template’.Vetur(2304)

    [vue/comment-directive] cleareslint-plugin-vue

解决方法:

关于Cannot find name ‘template’.Vetur(2304)报错,搜索到的解决方法大都是建议把vetur报错关了,尝试后发现并没用

关于[vue/comment-directive] cleareslint-plugin-vue,大都建议将.eslintrc.js配置文件中添加代码:

"rules": {
    "vue/comment-directive": 'off'
}

我没有在我的项目文件中找到.eslintrc.js配置文件,所以通过eslint –init初始化,创建了.eslintrc.js配置文件,并且加上了代码,尝试后依然没用

后来将文件名改成artistlist2.vue之后,就没有报错了

但是不知道原因

ESlint报错[vue/comment-directive]cleareslint-plugin-vue及Cannot find name ‘template‘.

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/f30f4390fd.html