【发布时间】:2020-04-02 08:09:26
【问题描述】:
我已经使用 Visual Studio Code 工作了两天了。我尝试构建一个 Vue 应用程序。但是当我通过npm run serve 运行应用程序时,总是出现以下错误:
9:9 error Strings must use singlequote quotes
9:15 error Missing trailing comma comma-dangle
✖ 2 problems (2 errors, 0 warnings)
2 errors and 0 warnings potentially fixable with the `--fix` option.
我了解这些错误的含义,我尝试在单引号中输入字符串并在每行末尾插入逗号。但是 Visual Studio Code 总是去掉逗号,把单引号变成双引号……在这里你可以看到我安装了哪些插件:
【问题讨论】:
-
与vscode无关,vue构建系统构建时,会运行eslint规则,将某些事情视为错误。它告诉你希望你的代码行有问题,你没有提供代码,所以无能为力
-
您也可以在保存时格式化并让它自动为您格式化代码(并满足 eslint)
-
您需要哪个代码?我的代码还是 ESLint-Preferences?
-
@DenisTsoi 哪个插件可以做到这一点?我当前的设置似乎相反:当我添加逗号时,它会删除它;并且单引号转换为双引号...
标签: vue.js visual-studio-code vuejs2 single-quotes