[英]There should be no space after '{' (babel/object-curly-spacing)
I'm using shift + alt + f
for sorting my code in vscode
but why I'm Getting This Error:?我正在使用
shift + alt + f
在vscode
对我的代码进行排序,但为什么会出现此错误:?
Error:错误:
[eslint] There should be no space after '{' (babel/object-curly-spacing)
Code:代码:
User.findOne({ _id: temp }, (obj) => {
After removing space before _id and after temp, I haven't any error But How Should I Fix in vscode for auto arrange?在 _id 之前和 temp 之后删除空间后,我没有任何错误但是我应该如何在 vscode 中修复以进行自动排列?
In your VS Code settings, change javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces
to false
so it won't add those spaces before and after braces
. 在您的VS Code设置中,将
javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces
更改为false
这样就不会在花braces
之前和之后添加这些空格。
See here for more options related to formatting of Javascript code in VS. 有关与VS中Javascript代码格式相关的更多选项,请参见此处 。
如官方网站eslint.org 中所述,刚刚在.eslint.trc
文件中添加了吹线
"object-curly-spacing": [2, "always"]
in eslint just add在 eslint 中添加
rules:{
"arraysInObjects": false,
}
or run或运行
npm run lint -- --fix
To prevent vscode
from addin spaces when formatting your code.防止
vscode
在格式化代码时添加空格。
Open settings.json
and add the following lines打开
settings.json
并添加以下几行
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
This make the fix on both javascript and typescript formatters这对 javascript 和 typescript 格式化程序进行了修复
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.