With the extension Prettier-Code Formatter installed, set "editor.defaultFormatter": "esbenp.prettier-vscode" in User Settings.json. Reload the window, then open command palette, choose format document with, you would see prettier there. Try this and see if it solves your question. Answer from Molly_Wang on reddit.com
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 1892
Value is not accepted in VSCode settings · Issue #1892 · prettier/prettier-vscode
January 6, 2021 - setup defaultFormatter in settings ("editor.defaultFormatter": "esbenp.prettier-vscode")
Author   dmatis2
🌐
Reddit
reddit.com › r/vscode › why my vs code pettier not working ?
r/vscode on Reddit: Why my VS code pettier not working ?
March 13, 2021 -

I have been searching google for several hours.

Many user have similar problem with me. https://stackoverflow.com/questions/52586965/why-does-prettier-does-not-format-code-in-vs-code/64273353#64273353

But none of the solution works for me.

https://imgur.com/2ssn1Vt

I have prettier installed. And I have tried the following

1.Command + Shift + p

2.type format document with

3.select Configure Default Formatter...

https://imgur.com/xw5oYvS

Then I cant select Prettier as default.

I only give me Python(default) as the only option.

I have a setting.json inside my root. Is it related?

https://imgur.com/KbEdsOV

Discussions

Prettier does not work as default formatter in VS Code 1.57.1 on Windows.
Summary I have the Prettier extension installed, have the prettier npm package installed globally and in this project. It seems as though the Prettier extension is not starting and is missing in th... More on github.com
🌐 github.com
19
June 29, 2021
VS-Code Prettier Format On Save doesn't work - Stack Overflow
For about a month now, my Prettier extension has stopped working as it normally does. Most notably - format on save does not work. Other notes: Format on typing a ; works I get this error type sym... More on stackoverflow.com
🌐 stackoverflow.com
Prettier VSCode Not Consistent With CLI
Discussed in #3227 Originally posted by MarvNC December 14, 2023 I am using CLI 3.1.1 installed with npm globally. Meanwhile, my Prettier VSCode extension is v10.1.0. I'd been mildly annoyed fo... More on github.com
🌐 github.com
16
June 17, 2024
Prettier extension not formatting code on file save - Stack Overflow
I have installed prettier extension for VS Code, set it as default formatter, also set format on save to true in VS Code's settings file, and files are set to be saved automatically after some time... More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 2047
Prettier does not work as default formatter in VS Code 1.57.1 on Windows. · Issue #2047 · prettier/prettier-vscode
June 29, 2021 - { "editor.formatOnPaste": true, "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode" } Manually formatting doesn't work either. Running prettier in the command line does correctly format the file. Short summary of what is going on or to provide context.
Author   KerimG
🌐
DEV Community
dev.to › dmytrych › fixing-prettier-not-working-with-vscode-44ml
Fixing Prettier not working with VSCode - DEV Community
June 9, 2023 - Prettier can be configured to disable parsing for certain file types - so check that the required files are not included in the prettier-ignore file. Also, check that your file extension is spelled correctly.
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 3431
Prettier VSCode Not Consistent With CLI · Issue #3431 · prettier/prettier-vscode
June 17, 2024 - .prettierrc or .editorconfig), VS Code configuration will not be used ["INFO" - 3:21:31 PM] Prettier Options: { "filepath": "h:\\code\\yomitan-dict-stats\\readme.md", "parser": "markdown", "singleQuote": true, "proseWrap": "never" } ["INFO" - 3:21:31 PM] Formatting completed in 199ms.
Author   hamirmahal
Find elsewhere
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 3104
prettier 3.0 and prettier-vscode v10.1.0 won't load plugins · Issue #3104 · prettier/prettier-vscode
August 1, 2023 - Summary In my project, VS Code successfully loads my Prettier config, but when I try and format a tsx file it logs an error. Visual Studio Code is on version 1.80.2. My config is as follows, and is exported as a package in a monorepo and...
Author   lewisflude
🌐
DEV Community
dev.to › robole › vs-code-you-dont-need-a-formatting-extension-prettier-and-friends-26cm
VS Code - You don't need a formatting extension (Prettier and friends) - DEV Community
June 2, 2022 - Question: "vscode.typescript-language-features" formatter *.js files? I tested as below settings. "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode", // worked! //"editor.defaultFormatter": "vscode.typescript-language-features" //Not worked?
Top answer
1 of 6
20

TO START:

Its helpful to know which "settings.json" your configuring. You need to make sure that both your workspace ".vscode/settings.json" file, and your user "settings.json" file (path is contingent on the O.S. your running) are configured to work harmoniously, and that one is not overriding the other with the same configuration twice.

SECONDLY

Remove all configurations you added to your "./settings.json" file for prettier. Those settings were added by the extension author. Despite the esbenp.prettier-vscode being the official prettier extension for VS Code, Prettier was never intended to be configured via VS Code's configuration files. Prettier is very nit-picky about its "./.prettierrc" configuration file. When we use the VS Code config ("settings.json") when attempt to use a prettier config that the extension generates somewhere. If you end up with settings in some project workspace vscode configurations (e.g. ".vscode/settings.json" files) the extension will try to regenerate a file each time one loads a prettier setting. It may even try to load multiple, depending on the scope of your settings.json file. Some how it has to handle that the user-scoped settings.json file should always be overriden by a workspace "settings.json" configuration file. That's not to mention that prettier configs often contain there own overridden rule sets within the ".prettierrc" configuration file.

  • Note: Just FYI, the most problematic configuration your using is the "prettier.configPath" setting.

_I'm going to stop going down the rabbit hole, hopefully you get the point I am making, which is: Don't use VS Code settings.json configuration files to configure "Prettier".


This will be more easy to explain with a bullet-list

The following will help you configure a clean environment, one where Prettier will work as you have configure it to work.

To start...

  1. ...delete all Prettier settings that you added to all settings.json files. This includes any Prettier settings you added to project ".vscode/settings.json" files, and it especially includes all Prettier-settings that you added to your user "settings.json" file. After you finish, reload VS Code, by closing it out completely, and reopening it.


  1. Rather than delete all prettier configuration files from any projects you have open, I am going to instead ask that when you reopen VS Code, that you only open one instance of VS Code. If VS Code opens a project (aka project-folder) after restarting, you're going to want to close that project w/o opening another one. To do that you can...
    • Use the keybinding ALT + K followed by the F key.
    • Alternatively you can use the title-bar menu like so: FILE  >>  CLOSE FOLDER

Additionally, make sure all tabs are closed as well.



  1. At this point your instance of VS Code should be totally empty, completely a blank canvas. From here you are going to want to create a new file. To do this...

    • You have one of two options

      • (A) You can use the keybinding CTRL + ALT + SUPER + N
      • (B) Another way to achieve the same thing is to use the title-bar menu like so:   FILE  >>  NEW FILE
    • Once you've prompted VS Code to create a new file VS Code will want you to pick a location where it's to be created at. The location doesn't matter, so long as it is in a completely empty file, with nothing else in it. To name the file, VS Code will probably use the drop-down that is often refereed to as the quick input menu. The file needs to be a JavaScript file, as a consequence, the file must end with the file extension ".js". So I can reference the file later, I will call mine "main.js", but you can call your whatever you want, so long as you know which file I am referencing when you read "main.js".

    • In the same folder as "main.js", create one more new file without a file extension. This file MUST HAVE THE NAME...

    • .prettierrc

NOTE: "The file has a period (or dot) as the first character in its name (this makes it a hidden file)."



  1. Add the following prettier configuration to the ".prettierrc" file you just created.
Copy{
  "trailingComma": "es5",
  "tabWidth": 4,
  "semi": true,
  "singleQuote": true
}


  1. **Execute the following commands"
    1. Copy $ npm init
      
      • The command will ask a bunch of questions, just press enter for each one to quickly configure the environment with the default npm/Node.js configuration.
      • The purpose of this is simply to create a valid "package.json" file.
    2. Copy   $ sudo npm i -g prettier && npm i -D prettier
      
         // Or you can execute it as two commands, like this:
      
         $ sudo npm i -g prettier
         $ npm i -D prettier
      
      • The command (or commands, depending on how you enter them) install prettier as a project dependency, and as a global Node.js package.

NOTE: "Make sure that you have prettier installed as a vscode extension. And make sure that you have only one prettier extension. Having multiple can create problems and confusion. The one you should have should have the Extension ID: esbenp.prettier-vscode "



  1. Prettier Should work now. Use the main.js file we created early to write some javascript, then press F1 to open the quick input, type the word "format document", until you see the option "Format Document", which you want to click. Then choose prettier from the menu. Prettier won't format if you have erroneous code, it needs to be free from error. (if you want to fix errors use a linter like ESLint).

You can add a bunch of blank lines, or put braces on the wrong line, leave out semi colons, and prettier should format all of those mistakes.




2 of 6
3

After creating a new .prettierrc.json file in a NextJS project and attempting to configure Prettier via .vscode/settings.json (with the Prettier VSCode extension running), I also kept running into Prettier Output errors.

I updated my .vscode/settings.json file to {}, and like the above comment, Prettier now works as expected.

🌐
GitHub
github.com › prettier › prettier-vscode › issues › 3436
Invalid Version · Issue #3436 · prettier/prettier-vscode
March 17, 2024 - ["ERROR" - 1:52:51 PM] Error handling text editor change ["ERROR" - 1:52:51 PM] Invalid Version: [object Object] TypeError: Invalid Version: [object Object] at new SemVer (d:\workspace\project*\node_modules\prettier\index.js:2461:13) at compare (d:\workspace\project*\node_modules\prettier\index.js:2818:12) at Function.gte (d:\workspace\project*\node_modules\prettier\index.js:2884:12) at filterSince (d:\workspace\project*\node_modules\prettier\index.js:4321:82) at Array.filter () at getSupportInfo (d:\workspace\project*\node_modules\prettier\index.js:4254:6) at Object.getSupportInfo (d:\workspa
Author   busyhe
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 3071
Prettier does not format documents in latest Prettier + VS code versions · Issue #3071 · prettier/prettier-vscode
May 21, 2023 - Summary Prettier does not format code, error and logs shown below. Using: Ubuntu: 22.04.2 in Windows + WSL 2 VS Code: 1.80.0 Prettier: 9.19.0 Github Repository to Reproduce Issue Installed the latest prettier vs-code extension. Steps To ...
Author   OmerMessing
🌐
Reddit
reddit.com › r/reactjs › [error] invalid prettier configuration file detected. prettier not working with .cjs or js formats, only json
r/reactjs on Reddit: [Error] Invalid prettier configuration file detected. Prettier not working with .cjs or js formats, only JSON
July 12, 2023 -

I am using vite for my project, and when i do ctrl + s, and look at the output of prettier in the console, it says

["ERROR" - 10:58:51 AM] Invalid prettier configuration file detected.

When I change my prettier.config.js to JSON format, it works fine, but I want it as .cjs so that I can use the following in my prettier file. I am trying to get the sorting for classes working (I am new to tailwind css)

module.exports = { plugins: [require('prettier-plugin-tailwindcss')], }

I am attaching my github repo as well, maybe this can help. thanks. https://github.com/ForkEyeee/memory-card

edit: i got prettier working by changing the prettier.config.cjs to

// prettier.config.cjs
module.exports = { trailingComma: "all", tabWidth: 2, semi: true, singleQuote: true, printWidth: 120, bracketSpacing: true, tailwindConfig: "./styles/tailwind.config.js", };

and now prettier works, but the sorting of classes in tailwind still doesnt work, not sure why

🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-format-code-with-prettier-in-visual-studio-code
Format Code with Prettier in Visual Studio Code: Setup Guide | DigitalOcean
August 1, 2025 - Note: If you do not see a prompt for selecting a default formatter, you can manually set Prettier as the default formatter in VS Code. Open your Settings and set Editor: Default Formatter to esbenp.prettier-vscode.
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 3112
esbenp.prettier-vscode take to long time saving a file · Issue #3112 · prettier/prettier-vscode
July 6, 2023 - Type: Bug Visual studio code take to long time sanving a file with esbenp.prettier-vscode extension. Extension version: 10.1.0 VS Code version: Code 1.81.0 (6445d93c81ebe42c4cbd7a60712e0b17d9463e97, 2023-08-02T12:36:11.334Z) OS version: ...
Author   angelocorreia27
🌐
C# Corner
c-sharpcorner.com › blogs › visual-studio-code-prettier-extension-set-up
Visual Studio Code Prettier Extension Set up
July 29, 2022 - Recently, I needed to use a Prettier code formatter extension in visual studio code. I thought the Prettier code would be similar to other extensions, but it is not. In Prettier code, there is a setting that we need to use for this extension to work automatically.
🌐
DEV Community
dev.to › nhisyamj › configure-prettier-on-vs-code-and-intellij-4ac
How to Configure Prettier on VS Code and IntelliJ - DEV Community
June 28, 2024 - #prettier #plugin #vscode #intellij · Bismillah. Prettier Configuration on VS Code · Install Prettier Plugin: Open VS Code. Go to Extensions and search for "Prettier". Install the Prettier extension. Modify Setting · Navigate to Preferences > Settings. Search for @lang:javascript settings. Click "Edit in settings.json" and add: { "[javascript]": { "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[javascriptreact]": { "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode" } } Prettier Configuration on IntelliJ IDEA ·