VScode解决格式化后单引号变双引号,去除多余逗号
Vue报警问题
对于使用Vue-cli脚手架存在的一些格式规则上的报警问题
报警代码如下
1、Strings must use singlequote // 字符串必须使用单引号
2、Extra semicolon // 额外分号
3、Unexpected trailing comma // 意外的尾随逗号
4、Missing space before function parentheses // 函数括号前缺少空格
5、Trailing spaces not allowed // 不允许使用尾随空格
6、Expected space or tab after '//' in comment // 注释中“//”后面应有空格或制表符
7、A space is required after ',' // “,”后面需要空格
8、Too many blank lines at the end of file. Max of 0 allowed // 文件末尾的空行太多。允许的最大值为0
对于1,2需要在脚手架的目录内,添加与src同级的.prettierrc.json文件
json文件内容如下
{
"singleQuote": true,
"semi": false
}
对于3只需在VS Code的首选项-设置里的settings.json配置项将
{
// "editor.formatOnSave": true,
}
注销即可
其他规则手动更改