关于vue告警:Closing curly brace does not appear on the same line as the subsequent block

版权声明:转载请注明出处,谢谢! https://blog.csdn.net/dreamstone_xiaoqw/article/details/90378794

最近在用vscode写vue,有两个目的,一方面是重构下小编渣站的前端,另一方面也是主要原因:

小编见到新技术就像狼闻到肉,老光棍看到俏姑娘,心里跟猫挠似的,不下手尝尝鲜那真是食不甘味、寝不安席。

So,毛毛躁躁上下其手不亦乐乎~

整理代码时控制台报了一个警告:

✘  http://eslint.org/docs/rules/brace-style  Closing curly brace does not appear on the same line as the subsequent block
  src\components\question.vue:74:7
}

这行警告的关键信息:

Closing curly brace does not appear on the same line as the subsequent block……

百度翻译如下:

右大括号与下一个块不在同一行

也就是说,在当前场景大括号不能单独占一行。(PS:为了节省纸张么?环保从我做起?)

用代码来说明,即:将

if (flag) {
	doSomeThing();
}
else {
	doOtherThing();
}

修改为

if (flag) {
	doSomeThing();
} else {
	doOtherThing();
}

即可。

扫描二维码关注公众号,回复: 6391719 查看本文章

阿西吧,不得不感叹,vue对编程风格的约束真是严格啊,这样的小事情都要管……

附静态代码检查工具eslint的专业解答:https://eslint.org/docs/1.10.3/rules/brace-style

猜你喜欢

转载自blog.csdn.net/dreamstone_xiaoqw/article/details/90378794