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…
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…
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: