indent size is 2 instead of 4 - Failed to resolve config - No local configuration detected
See original GitHub issueSummary
My .prettierrc file is not used to format my files.
Expected result
I expect the file to be formatted with 4 spaces
Actual result
The file gets formatted with 2 spaces
Screenshot
VS Code Version: 1.40.1
Prettier & Prettier Plugin Version: “prettier”: “^1.19.1” “prettier plugin”: [3.8.0]
OS and version: Windows 10 Pro
.editorconfig
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
.prettierrc
{
"bracketSpacing": true,
"bracesSpacing": true,
"jsxBracketSameLine": true,
"jsxSingleQuote": true,
"noSemi": true,
"printWidth": 120,
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "none",
"useTabs": false
}
.prettierignore
.vscode/*
package.json
yarn.lock
I tried to delete the .prettierignore file, but I keep seeing this log :
Resolved ignore file to c:\repos\project\.prettierignore
I restared VSCode many times, and everytime I use the format commande I see this message. 😠
settings.json
{
"editor.tabSize": 4,
"editor.detectIndentation": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
Prettier Log Output
[INFO - 3:14:35 PM] Formatting c:\repos\project\Components\Order.jsx.
[INFO - 3:14:35 PM] Loaded module 'prettier@1.19.1' from 'c:\repos\project\node_modules\prettier\index.js'.
[INFO - 3:14:35 PM] Resolved ignore file to c:\repos\project\.prettierignore.
[INFO - 3:14:35 PM] File Info:
{
"ignored": false,
"inferredParser": "babel"
}
[ERROR - 3:14:35 PM] Failed to resolve config for c:\repos\project\Components\Order.jsx. Falling back to the default config settings.
[INFO - 3:14:35 PM] No local configuration detected, using VS Code configuration.
[INFO - 3:14:35 PM] Prettier Options:
{
"arrowParens": "avoid",
"bracketSpacing": true,
"endOfLine": "auto",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false,
"vueIndentScriptAndStyle": false,
"filepath": "c:\\repos\\project\\Components\\Order.jsx",
"parser": "babel"
}
[INFO - 3:14:35 PM] Formatting completed in 31.861999ms.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
indent size is 2 instead of 4 - Failed to resolve config - No local ...
indent size is 2 instead of 4 - Failed to resolve config - No local configuration detected.
Read more >Prettier is not indenting as specified - Stack Overflow
I desire 4 spaces for tabs (second picture) but it ignores the editor settings and does 2 (first picture). I know it is...
Read more >Tabs and Indents are 2 spaces despite setting at 4 spaces
I am using WebStorm 9 on Ubuntu 14.4. Tabs come out at 2 spaces when I hit TAB or Enter, not 4 spaces....
Read more >November 2020 (version 1.52) - Visual Studio Code
When you start VS Code on Linux or macOS for the first time via the dock or a launcher (and not the terminal),...
Read more >Microsoft Edge Browser Policy Documentation
Use the links in the table to get more details about specific policies. Application Guard settings; Cast; Content settings; Default search ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I have somewhat figured out what is going on here. It appears to be a text encoding issue with the
.prettierrc
file. I added some additional logging in v3.11.0 (just released). When using the provided repo I noticed the following error:The immediate fix is to change the encoding of the
.prettierrc
file to utf8. I will try to see if there is a better fix later, but this should unblock you at the moment.This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.