'{' (babel/object-curly-spacing) 后不应有 space
There should be no space after '{' (babel/object-curly-spacing)
我正在使用 shift + alt + f
对 vscode
中的代码进行排序,但为什么我会收到此错误:?
错误:
[eslint] There should be no space after '{' (babel/object-curly-spacing)
代码:
User.findOne({ _id: temp }, (obj) => {
删除 _id 之前和 temp 之后的 space 后,我没有任何错误但是我应该如何修复 vscode 以进行自动排列?
在您的 VS Code 设置中,将 javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces
更改为 false
这样它就不会在 braces
前后添加那些空格了。
有关在 VS 中格式化 Javascript 代码的更多选项,请参见 here。
在 eslint 中只需添加
rules:{
"arraysInObjects": false,
}
或运行
npm run lint -- --fix
如官方网站所述eslint.org
刚刚在 .eslint.trc
文件
中添加了打击线
"object-curly-spacing": [2, "always"]
防止 vscode
在格式化代码时添加空格。
打开 settings.json
并添加以下行
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
这修复了 javascript 和 typescript 格式化程序
我正在使用 shift + alt + f
对 vscode
中的代码进行排序,但为什么我会收到此错误:?
错误:
[eslint] There should be no space after '{' (babel/object-curly-spacing)
代码:
User.findOne({ _id: temp }, (obj) => {
删除 _id 之前和 temp 之后的 space 后,我没有任何错误但是我应该如何修复 vscode 以进行自动排列?
在您的 VS Code 设置中,将 javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces
更改为 false
这样它就不会在 braces
前后添加那些空格了。
有关在 VS 中格式化 Javascript 代码的更多选项,请参见 here。
在 eslint 中只需添加
rules:{
"arraysInObjects": false,
}
或运行
npm run lint -- --fix
如官方网站所述eslint.org
刚刚在 .eslint.trc
文件
"object-curly-spacing": [2, "always"]
防止 vscode
在格式化代码时添加空格。
打开 settings.json
并添加以下行
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
这修复了 javascript 和 typescript 格式化程序