[英]VSCode ESLint on save - for Vue.js
I'm new to ESLint in vscode and vue.js我是 vscode 和vue.js中 ESLint 的新手
I ran yarn add -D eslint eslint-plugin-vue
and have this "eslint-plugin-vue": "^8.1.1"
in my package.json我运行
yarn add -D eslint eslint-plugin-vue
并在我的package.json中有这个"eslint-plugin-vue": "^8.1.1"
I have a file at the root of my folder我的文件夹根目录有一个文件
.eslintrc .eslintrc
{
"extends": [
"eslint:recommended",
"plugin:vue/recommended"
],
"rules": {
"vue/html-self-closing": "off"
}
}
I also have this in my settings.json我的设置中也有这个。json
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"vetur.validation.template": true,
I tried to, purposely spell component
wrong.我试过了,故意拼错
component
。
When I saved the file, It didn't stop me and highlight that I spelled wrong.当我保存文件时,它并没有阻止我并强调我拼写错误。
What did I do wrong here?我在这里做错了什么?
Can someone please help me get my VSCode going with eslint for vue.js?有人可以帮我让我的 VSCode 与 vue.js 的 eslint 一起使用吗?
I didn't found a way to prevent this specific typo, but adding this to your rules inside .eslintrc
file would give you a heads up next time.我没有找到防止这种特定错字的方法,但是将其添加到
.eslintrc
文件中的规则中会让您下次注意。
"vue/no-restricted-component-options": [
"error",
{
"name": "component",
"message": "Use \"components\" instead."
}
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.