For those trying to quickly change Prettier settings for VS Code. Here are the steps:

  1. Go to FILE -> PREFERENCES -> SETTINGS. (VS Code Menus)
  2. Settings window should open. Above (Top) there is a search. Type "Prettier"
  3. You should see the available Prettier settings. You can modify them :)
Answer from Steph on Stack Overflow
🌐
GitHub
github.com › prisma-labs › prettier-config › blob › master › prettier-config.json
prettier-config/prettier-config.json at master · prisma-labs/prettier-config
Standard Prettier configuration for Labs team projects. - prettier-config/prettier-config.json at master · prisma-labs/prettier-config
Author   prisma-labs
🌐
Fraser Boag
boag.online › notepad › post › full-prettier-prettierrc-config
My full Prettier (.prettierrc) config file - Fraser Boag
This allows different projects to have different configuration, and allows you to check this file into the project's git repo, ensuring all developers are committing code with the same style. But enough waffle - here's the .prettierrc file I've landed on and use in every new project.
🌐
Gleb Bahmutov
glebbahmutov.com › blog › configure-prettier-in-vscode
How to configure Prettier and VSCode | Better world by better software
April 23, 2024 - At the root of the project create the Prettier configuration file. In my example I have two subfolders, and there is a configuration file in each subfolder: I like using JSON configuration format so my code editor helps me. In fact, VSCode understands the Prettier configuration file format via the built-in json schema.
🌐
npm
npmjs.com › package › prettier-config-standard
prettier-config-standard - npm
This means you can configure prettier via: A .prettierrc file, written in YAML or JSON, with optional extensions: .yaml/.yml/.json.
      » npm install prettier-config-standard
    
Published   Aug 11, 2023
Version   7.0.0
Author   Nick Petruzzelli
🌐
GitHub
github.com › prettier › prettier › discussions › 15258
How to correctly setup Configuration File to config JSON file formatting? · prettier/prettier · Discussion #15258
Here's the corrected version: My goal is to set up Prettier to use tabs for indentation instead of spaces for JSON files using Configuration File. So far, I have done the following, but when format...
Author   prettier
Find elsewhere
🌐
Blitzjs
legacy.blitzjs.com › docs › prettier-config
Custom Prettier Config - Blitz.js
By default, new Blitz apps configure prettier using the "prettier" key in the package.json file
🌐
MegaLinter
megalinter.io › latest › descriptors › json_prettier
prettier configuration in MegaLinter - MegaLinter by OX Security
--require-pragma Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted. Defaults to false. --stdin-filepath <path> Path to the file to pretend that stdin comes from.
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 3442
"prettier.configPath" in vscode's settings.json is ignored · Issue #3442 · prettier/prettier-vscode
June 21, 2024 - Create $HOME/.config/prettier/prettierrc with the content in "Additional information", and set one of the above strings in VSCode's $HOME/.config/Code/User/settings.json
Published   Jun 21, 2024
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 360000167624-How-can-I-change-the-prettier-settings
How can I change the prettier settings? – IDEs Support (IntelliJ Platform) | JetBrains
So, you can install it globally and configure it in your project, by adding the corresponding .prettierrc file or "prettier" section in project package.json.
Top answer
1 of 1
15

Correct Prettier Extension


There are many prettier extensions to choose from, but only one is the official prettier extension that was written by the same people who maintain prettier. You want to make sure that you have the OFFICIAL PRETTIER EXTENSION.

  • HERE IS THE LINK TO THE OFFICIAL PRETTIER EXTENSION

  • To verify that it is the official extension, its unique extension ID will be: "esbenp.prettier-vscode".

  • The link shows the official extensions page in the Visual Studio website view, you will probably want to download it inside of your editor as opposed to installing it via a VSIX file.



  • You need to configure your default formatter in a generalized way to be able to format JavaScript & HTML. Your trying to specify configurations on a per language basis, which is usually the wrong thing to do if your trying to configure a formatter to format more than one language or file type. You just want prettier to be set as the default formatter, as opposed to the default formatter for HTML, there is a big difference between the two. One formats all languages, the other formats HTML only. for all of VS Code.

  • We also want to make sure that prettier is the formatter we are equipping. Currently you don't have the correct formatter configured. Your trying to use VS Codes Languag-features formatter to get the Prettier formatter to work.


I have included two examples of configuring your default formatter below.
  1. The first example shows the improper configuration that you are currently using. Which configures the formatter specific to a file extension, and it is configuring the wrong formatter

  2. The second configuration is the CORRECT CONFIGURATION TO USE. It configures the Official Prettier Formatting Extension for all of VSCode.



#1

The example below shows what NOT to do!
    /** @file "settings.json" */

    {
        "[html]": {
           "editor.defaultFormatter": "vscode.html-language-features"
    }

The incorrect configuration above does two things wrong.

  1. "vscode.html-language-features" is not the correct extension ID. You need to use the prettier formatter's extension ID. The Prettier extension id is as follows "esbenp.prettier-vscode"

  2. Your configuring the formatter to work for HTML files only.

    • "[HTML]":{ // settings ... } <-- adding prettier to that block configures prettier to only work if a file extension ends in HTML. The problem is, HTML doesn't always get placed in an .html document.

For the context of this question, it isn't technically wrong, but its not the best configuration to use when trying to troubleshoot the issue, instead; you should just set your default formatter as Prettier across all languages. Then once you get Prettier working, you can use settings that specify the languages you want to use it for, and languages you don't want to use it for.



#2

This snippet shows the CORRECT configuration to use
  /** @file "settings.json" */

  {
      "editor.defaultFormatter": "esbenp.prettier-vscode",
      "editor.formatOnSave": true,
  }

Notice that I added format on save? You want that so when you press CTRL + S your code is formatted.



Another thing you don't want to do is configure prettier in your settings.json file.

DONT DO THIS

/** @file "settings.json" */

{
    "prettier.arrowParens": "avoid",
    "prettier.jsxBracketSameLine": true,
    "prettier.bracketSpacing": true,
    "prettier.embeddedLanguageFormatting": "auto",
    "prettier.htmlWhitespaceSensitivity": "css",
    "prettier.insertPragma": false,
    "prettier.jsxSingleQuote": true,
    "prettier.printWidth": 100,
    "prettier.proseWrap": "preserve",
    "prettier.quoteProps": "as-needed",
    "prettier.requirePragma": false,
    "prettier.semi": true,
    "prettier.singleQuote": false,
    "prettier.tabWidth": 2,
    "prettier.trailingComma": "es5",
    "prettier.useTabs": true,
    "prettier.vueIndentScriptAndStyle": false,
}

WHAT YOU WANT TO DO TO CONFIGURE PRETTIER, IS ADD A .prettierrc CONFIGURATION FILE TO EVERY PROJECT.


  1. The prettier configuration file is named ".prettierrc"

  2. The .prettierrc file should be placed in the ROOT directory of your project.

  3. Add the following to your ".prettierrc" document.

{
  "trailingComma": "es5",
  "tabWidth": 4,
  "semi": false,
  "singleQuote": true
}

Here is the link to Prettier's page that shows all available configurations you can add to your prettier file.

At this point Prettier should be working

If prettier isn't working, then you are going to need to get the debugging information about why it isn't working from the prettier extension. Prettier outputs this information for you, but you have to know how to get it.



Getting Debugging Info from the V.S. Code Prettier Extension


NOTE: Stack overflow requires debugging details for every question about an issue. If prettier isn't working getting these debugging details will help you ask your question without people giving you to hard of a time on here.

Add the following setting to your settings.json file

"prettier.enableDebugLogs": true

then open your terminals panel, but instead of using the terminal, your going to click on the OUTPUT option at the top of the panel instead, then in the drop down to the right, select prettier from the menu. This will tell you what is happening each time prettier tries to format.

If your still stuck, get to this point, where you have started to debug/troubleshoot prettier, and comment below about what the debugging info says, or ask a new question and include the debugging info.



END OF EDIT

🌐
Michael Currin
michaelcurrin.github.io › dev-cheatsheets › cheatsheets › javascript › format-and-lint › prettier › configure.html
Config files | Dev Cheatsheets
Example config with one rule in it: .prettierrc.json · { "arrowParens": "avoid" } Some more rules. .prettierrc.json · { "trailingComma": "es5", "tabWidth": 4, "semi": false, "singleQuote": true } See the Ignoring rules cheatsheet for more info. You can also pass command line flags to change Prettier behavior.
🌐
Prettier
prettier.io › blog › 2025 › 02 › 09 › 3.5.0
Prettier 3.5: New objectWrap option, experimentalOperatorPosition option and TS config file support! · Prettier
February 9, 2025 - Since Prettier 3.5, we can read prettier config from it without error. However, since it's just a Bun feature and not supported by Node.js, it can only work when running Prettier with Bun. Important note: Prettier uses json-stringify parser to format package.json file by default, to support formatting package.json file with JSONC syntax, you need override the parser option
🌐
Code-boost
code-boost.com › prettier-setup-guide
Prettier Code Formatter Setup Guide – Code Boost
Integrate Prettier into your ... a script in your package.json to format your codebase: ... This command will automatically format all supported files in your project, keeping your code clean and consistent. Remember, Prettier’s configuration is highly customiza...
🌐
GitHub
gist.github.com › adbutterfield › 6b91625b5b07ca2c29f6322245e3e2bb
Default prettier config with comments and links to prettier rules · GitHub
The correct answer, since you are just asserting prettier's defaults, is to remove the rangeEnd config line in your *.yaml file. ... I still seem to have a few issues with this approach. One is that the default settings above do not seem to match the settings that are applied when running prettier --write in the CLI. Tweaking a few options I managed to get it to work. Except for one thing. It seems that the formatOnSave functionality insists on moving array indices into separate lines (noticed in JSON files), while the CLI command prettier --write moves them back into one line.
🌐
JSONLint
jsonlint.com › datasets › config-prettier
Prettier Config JSON Dataset | JSONLint
JSON Dataset · Loading dataset... Example Prettier configuration file. Download JSON · Open in JSONLint · Download JSONView Raw JSON · Airports · Colors · Config Eslint · Config Package · Config Tsconfig · Continents · Countries · Css Colors · Currencies ·