Questions tagged [prettier-vscode]
121 questions
16
votes
9 answers
Prettier vscode extension ignoring config files
I can't get the prettier extension to use my config files. It keeps using the global settings (as defined in the config path setting in vscode). I made an example project:
https://github.com/Supperhero1/prettierTest
I set tabWidth to 1 in the…

Supperhero
- 911
- 1
- 7
- 24
11
votes
2 answers
Prettier VSCode JSON Format Error - SyntaxError: ';' expected
Prettier VSCode JSON Format Error
I'm trying to format a JSON file in VS Code using Prettier, however, I have yet to successfully format any JSON files. I searched for a solution using Google, but was unable to return any useful search…

Manny
- 1,034
- 1
- 11
- 16
9
votes
5 answers
Prettier: invalid configuration file even though the file is straight from the docs
So I tried installing the prettier today, I followed the instructions straight from the docs.
npm install --save-dev --save-exact prettier
echo {}> .prettierrc.json
then I create a .prettierignore and copy-pasted what's written in my .gitignore in…

jove0610
- 664
- 1
- 8
- 16
8
votes
0 answers
Visual Studio Code Prettier extension intermittently throws an error on formatting
I need to restart Visual Studio Code several times a day because the Prettier formatter extension (esbenp.prettier-vscode) throws errors. It is as if the extension gets confused after numerous successful formats. Once the editor has been re-opened,…

Clarice Bouwer
- 3,631
- 3
- 32
- 55
8
votes
1 answer
Weird HTML formatting with prettier
I have this HTML when I use the built-in formatter. Not good. I want every tag to be cascaded. Here, we have span and svg and a on same line.
After formatting with prettier (this version)
I get this. This is almost worse. (see edit section later…

Fred Eric
- 135
- 1
- 1
- 10
6
votes
1 answer
VS code Prettier extension does not recognize the satisfies operator
I want to use typescript's new satisfies operator but VS code Prettier extension does not seem to recognize it and stops working.
I have updated Typescript, Eslint, Prettier, and VS code Prettier extension to the latest versions but still getting…

Tanmay Bindal
- 78
- 6
6
votes
0 answers
disable multiline ternary in prettier
Is there way to config prettier to prevent not multi line the ternary operation?
wanted this:
const route = routeModule.config ? routeModule.config(router) : routeModule(router);
not this:
const route = routeModule.config
?…

Mohsen
- 1,295
- 1
- 15
- 45
6
votes
1 answer
How to make prettier (php) to work with VS Code
I have prettier installed on VS code but it does not seem to have any functionality. I installed Prettier - Code formatter (6.4.0) through VS code extensions, I am using the latest version of VScode and there are no updates available.
Both the…

David Linder
- 83
- 1
- 6
6
votes
1 answer
VS Code + Prettier not using printWidth setting?
I'm trying to get Prettier to format my files with a printWidth of 80 chars (what I understand to be the default). However, even with my user settings configured:
"prettier.printWidth": 80
AND using a .prettierrc config in the project:
{
…

Rob Lauer
- 3,075
- 1
- 32
- 44
5
votes
0 answers
How to make Prettier ignore markdown comments for newlines
I have a markdown file with:
## Title name
but when I format it with Prettier, it will automatically add a newline:
## Title name
Is there any way to stop Prettier from doing this will keeping its other…

lklklklkpopopo
- 71
- 3
4
votes
4 answers
Prettier - allow line breaks between html elements
I'd like to keep some space between some html blocks in my code. However, Prettier wants to remove these lines. Is there a Prettier setting to keep this spacing?
Before prettier:
4
votes
0 answers
prettier and eslint max-len code fix not working properly
I have just configured eslint and prettier in my project and set up a rule for max len. But it is not working as expected. I wanted to break the line when the it exceeds 120 characters. It does break the line but only when the character length is…

Satyam Saurabh
- 488
- 4
- 16
4
votes
1 answer
VS Code auto save afterDelay w/Prettier not working
VS Code version: 1.64.2
Prettier Extension version: 9.2.0
I want it so Prettier runs on auto save, which should be every 500 milliseconds. I have the following in my workspace JSON:
{
"editor.formatOnSave": true,
"editor.defaultFormatter":…

Major Productions
- 5,914
- 13
- 70
- 149
4
votes
1 answer
How to prevent prettier to break single line into multiline?
I have written a single line of code.
And after save prettier reformat the line into 2.
How to stop prettier from breaking lines into two?

Mahbub Ul Islam
- 773
- 8
- 15
4
votes
1 answer
How to use prettier for specific language
I'm using VsCode with Prettied Extension. Prettier in some cases is formatting inside the HTML element (I.g. Class value), which is annoying, because its breaking the property in multiple lines unnecessarily, Hence:
I don't want to use…

Tanvir
- 1,642
- 8
- 32
- 53