Prettier-VSCode does not respect .prettierrc configuration for HTML formatting
See original GitHub issueI am having similar issues to the ones that have been raised before, prettier-vscode
does not seem to respect my project’s .prettierrc.json
configuration when formatting HTML files. The print width seems to be defaulted to 80 instead of our custom value of 100.
{
"printWidth": 100,
"tabWidth": 4,
"singleQuote": true
}
My vscode is setup to format on save, and our project’s package.json
references "prettier": "1.15.2"
.
The extension is up to date in vscode too.
Our project does not have a print width setting in the .editorconfig
file either.
I created a video reproduction of the issue where I save an AngularJS template file in vscode and it gets wrongly re-formated, and then apply the Prettier CLI on that file which puts it back to its correct format.
The video is available here (Dropbox - 2.1 MB).
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Prettier does not consistently respect .prettierrc, .eslintrc nor ...
I have a .prettierrc file, a .eslintrc file and even vscode settings with the same 80 print-width settings, but the extension just doesn't...
Read more >Prettier vscode extension ignoring config files - Stack Overflow
In VS Code Press open Command Palette (Ctrl + Shift + P) · Search and select this: Format Document With... · After selecting...
Read more >How to configure Prettier and VSCode - Gleb Bahmutov
This blog post shows how to configure Prettier to work from command line, from VSCode and from Git hooks.
Read more >Options - Prettier
Prettier ships with a handful of format options. ... Prettier's printWidth option does not work the same way. It is not the hard...
Read more >Prettier Code Formatter | Salesforce for VSCode
Prettier code formatter supports Aura and Lightning Web Components (LWC) as well as standard file formats such as JSON, Markdown, HTML, and JavaScript....
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
It seems we do not infer the same parser as prettier’s cli. This extension uses angular parser where prettier uses html parser. CLI:
The extension doesn’t take into account files’ extensions, only vscode’s languageId
To workaround this issue. You can specify explicitly the parser you want to use.
In my case, another extension was causing this issue. I uninstalled “XML Tools” and it started working!