admin管理员组文章数量:1252850
I'm using shift + alt + f
for sorting my code in vscode
but why I'm Getting This Error:?
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?
I'm using shift + alt + f
for sorting my code in vscode
but why I'm Getting This Error:?
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?
Share Improve this question asked Jan 20, 2018 at 0:44 Saeed HeidarizareiSaeed Heidarizarei 8,91622 gold badges66 silver badges111 bronze badges 5 |4 Answers
Reset to default 10In your VS Code settings, change javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces
to false
so it won't add those spaces before and after braces
.
See here for more options related to formatting of Javascript code in VS.
as described in the official site eslint.org
just added the blow line in .eslint.trc
file
"object-curly-spacing": [2, "always"]
in eslint just add
rules:{
"arraysInObjects": false,
}
or run
npm run lint -- --fix
To prevent vscode
from addin spaces when formatting your code.
Open settings.json
and add the following lines
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
This make the fix on both javascript and typescript formatters
本文标签: javascriptThere should be no space after 3939 (babelobjectcurlyspacing)Stack Overflow
版权声明:本文标题:javascript - There should be no space after '{' (babelobject-curly-spacing) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738317191a2074338.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
editor.tabSize": 2
, andeditor.detectIndentation": false
– Saeed Heidarizarei Commented Jan 20, 2018 at 0:52babel/object-curly-spacing
checks. – Barmar Commented Jan 20, 2018 at 2:07