Reputation: 8956
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?
Upvotes: 8
Views: 15060
Reputation: 15840
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
Upvotes: 3
Reputation: 1361
as described in the official site eslint.org
just added the blow line in .eslint.trc
file
"object-curly-spacing": [2, "always"]
Upvotes: 9
Reputation: 1120
in eslint just add
rules:{
"arraysInObjects": false,
}
or run
npm run lint -- --fix
Upvotes: 6