Webstorm Indent size stucked with 2 instead of 4.

Hi guys, I have eslint and prettier. I want to have indent size to 4 but despite all the fixes that I  found nothing works so far. 

My Code Style setting:

I don't have EditorConfig file.

This is what my code looks like:

My prettier config

{
"singleQuote": false
}

My eslint config

{
"extends": [
"airbnb",
"prettier",
"plugin:node/recommended"
],
"plugins": [
"prettier"
],
"rules": {
"indent": [
"error",
4
],
"prettier/prettier": "error",
"spaced-comment": "off",
"no-console": "warn",
"consistent-return": "off",
"func-names": "off",
"object-shorthand": "off",
"no-process-exit": "off",
"no-param-reassign": "off",
"no-return-await": "off",
"no-underscore-dangle": "off",
"class-methods-use-this": "off",
"prefer-destructuring": [
"error",
{
"object": true,
"array": false
}
],
"no-unused-vars": [
"error",
{
"argsIgnorePattern": "req|res|next|val"
}
]
}
}
评论操作 固定链接

Is Prettier configured as your default formatter in Settings | Languages & Frameworks | JavaScript | Prettier? if yes, the IDE own indentation settings are ignored, as the file is formatted by Prettier; the default indent size for it is 2. You can try playing with the tabWidth as suggested in https://prettier.io/docs/en/options.html#tab-width

0
评论操作 固定链接

Thanks a lot! After a few hours of messing around, I actually fixed the issue by manually add an .editorconfig file, and I set indent_size to 4 in the editorconfig file which fix the problem. I still have prettier turned on, but the only thing in my .prettierrrc file is "singleQuote":false, which should be the default option anyway. In this case, can I disable the prettier entirely and perhaps delete it from the package? I have no clue what would prettier do since eslint is fixing all my formatting issues during the save. 

0
评论操作 固定链接

Sure you can uninstall prettier if you don't like using it for formatting

0

请先登录再写评论。