Follow these steps:

  1. CTRL + SHIFT + P
  2. Format Document (in pop-up bar)
  3. Select Format Document
  4. Select Configure Default Formatter...
  5. Select Prettier - Code formatter

Done!

Answer from Goku on Stack Overflow
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 845
Prettier does not work with some React native files · Issue #845 · prettier/prettier-vscode
February 12, 2019 - I have a setup with Prettier plugin and eslint in react. Some files sometimes don't work on save. Sometimes, when I remove specific parts of the file it starts working. But if I return them it ...
Published   Jun 02, 2019
🌐
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. Also, make sure that the settings correspond to the programming language you are using. Try disabling other VSCode extensions.
🌐
GitHub
github.com › microsoft › vscode › issues › 108447
Format on Save (prettier) stopped working with latest update · Issue #108447 · microsoft/vscode
October 10, 2020 - Format on Save (prettier) stopped working with the latest update Multiple time reinstalled Prettier, and checked the settings, it happened right after the update of VSCode. https://gyazo.com/f07a3b...
Published   Oct 10, 2020
🌐
Medium
medium.com › how-to-react › config-eslint-and-prettier-in-visual-studio-code-for-react-js-development-97bb2236b31a
Config Eslint and Prettier in Visual Studio Code for React js development | by Manish Mandal | How To React | Medium
November 9, 2020 - 4. Now we need to configure our VSCode settings for prettier to work on autosave. Follow the below-mentioned steps to configure your VScode Setting ... On your right-hand side, there is an icon to Open Settings in JSON format. Click on that icon. ... So now whenever you save your code or change the focus from the code, VSCode will automatically fix the format of your code. Note: you can also create local settings for VScode.
Find elsewhere
🌐
Reddit
reddit.com › r/vscode › suddenly prettier has stopped working with vscode?
r/vscode on Reddit: Suddenly prettier has stopped working with vscode?
March 1, 2023 -

Hello, I really need help, prettier just stopped working with react for no reason, as you can see it works with json files, but not react. What could be the reason? here is my settings.json:

{
  "editor.bracketPairColorization.enabled": true,
  "editor.accessibilitySupport": "off",
  "editor.formatOnSave": true,
  "typescript.updateImportsOnFileMove.enabled": "always",
  "editor.inlineSuggest.enabled": true,
  "github.copilot.enable": {
    "*": true,
    "yaml": false,
    "plaintext": true,
    "markdown": true
  },
  "window.zoomLevel": -2,
  "github.copilot.advanced": {},
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnPaste": true,
  "[typescriptreact]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
}

How can it suddenly stop working?

🌐
DEV Community
dev.to › timo_ernst › prettier-autoformat-for-typescript-not-working-13d8
Prettier Autoformat for TypeScript not Working - DEV Community
October 9, 2020 - However, when using TypeScript files with React/JSX (.tsx) it didn’t work. Here is how to fix it: First, press shift + cmd + p (Mac), enter “settings” and choose “Preferences: Open Settings (JSON)”. Then add the following: "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }
🌐
Bobby Hadz
bobbyhadz.com › blog › fix-prettier-not-working-in-vs-code
How to fix Prettier Extension not working in VS Code | bobbyhadz
Make sure you haven't set formatOnSave to false locally in .vscode/settings.json. You might also have the setting in your package.json file which also takes precedence over your global config. Another thing you can try is to reinstall the Prettier extension:
🌐
Avenuecode
blog.avenuecode.com › how-to-integrate-prettier-and-eslint-in-vscode-and-react
How to Integrate Prettier and ESLint in VSCode and React
October 12, 2022 - $ npm install -D eslint prettier eslint-config-prettier # or $ yarn add -D eslint prettier eslint-config-prettier · Now, run the ESLint init script to initialize the linter in your project with custom configurations. ... ? How would you like to use ESLint? > To check syntax, find problems, and enforce code style ? What type of modules does your project use? > JavaScript modules (import/export) ? Which framework does your project use? > React ?
🌐
Reddit
reddit.com › r/reactjs › problems with prettier formatting my .tsx files in vscode.
r/reactjs on Reddit: Problems with Prettier formatting my .tsx files in VSCode.
July 30, 2017 -

I'm having a lot of trouble with prettier formatting my .tsx files in VSCode. I've tried many things to get prettier to work. I've disabled typescript formatting and set the default to prettier, but it didn't work. It's just not happening. I've settled for formatting everything myself, but I'm prettier-spoiled and I want prettier to format my .tsx files too. How have you (people who are savvier than I) gotten .tsx files to auto format with prettier using VSCode?

🌐
YouTube
youtube.com › code commerce
How to fix Prettier Extension in VS Code - YouTube
I just updated VS Code and my prettier extension (to format all of my code) was not working. I didn't realize how much I needed this extension! Fortunately ...
Published   February 19, 2022
Views   23K
🌐
SheCodes
shecodes.io › athena › 104-how-to-fix-prettier-not-working-in-vs-code
[VS Code] - How to Fix Prettier Not Working in VS Code - | SheCodes
Discover how to fix the Prettier's non-working issue on VS Code. Step-by-step guide with detailed technical help is available.
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 2744
prettier cannot be set as formatter for typescript, javascript and variations thereof (typescriptreact) · Issue #2744 · prettier/prettier-vscode
October 9, 2022 - "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true }, "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode", }, "[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode", }, and open any js or ts files and try to format them with prettier on my laptop, I get an error message like · Extension 'Prettier - Code formatter' is configured as formatter but it cannot format 'TypeScript React'-files · This, among other repos, have the same issue on my installation of vs code but not on github codespaces.
Published   Oct 09, 2022
🌐
Gleb Bahmutov
glebbahmutov.com › blog › configure-prettier-in-vscode
How to configure Prettier and VSCode | Better world by better software
April 23, 2024 - This configuration is in module eslint-config-prettier. Install it · and can be added to your project .eslintrc.json file. ESLint will not run without a valid configuration file. ... Then ESLint will catch the const assignment error; it will also catch that the variable name is never used after assignment. If you want to check React code that uses JSX, import / export keywords, then install a plugin eslint-plugin-react ... Since we are using VSCode, it makes sense to install ESLint VSCode extension called dbaeumer.vscode-eslint
🌐
DeveloperF1
developerf1.com › snippet › prettier-stopped-working-in-vs-code
Fix: Prettier stopped working in VS Code - DeveloperF1.com
September 5, 2023 - Type default formatter into the search field and check if it is set to Prettier · Alternative: You can also check if the default formatter is set correctly by simply forcing VSCode to format your code. To do click into the code editor and from the context menu select the Format Document option.
🌐
LinuxPip
linuxpip.org › vscode-prettier-not-working
Prettier not working in VSCode – possible fixes – LinuxPip
If the setting above does not solve the problem, you may need to set Prettier as preferred formatter in VSCode settings. Follow the steps below to do that. Open up VSCode settings in UI mode by selecting File > Preferences > Settings or press Ctrl + ,. Input “formatter” in the search box. Once you see Editor: Default Formatter section, select . This setting allows you to define a default formatter which takes precedence over all other formatter settings. Note : If it doesn’t work, you may have to reset VSCode settings before repeating the aforementioned steps.