Ah okay so the answer here was to implement the right Prettier rules in .prettierrc.
The VSCode Prettier settings can be set specifically for the workspace, which was what caused me confusion (I had trailingComma set to none in another workspace which made me confused about why that workspace was correctly formatting things).
I added this code to .prettierrc, which makes the Prettier formatter consistent with the ESLint rules:
{
"arrowParens": "avoid",
"trailingComma": "none",
"tabWidth": 2,
"semi": true,
"singleQuote": false
}
I (mistakenly?) thought that Prettier automatically derived its formatting options from the ESLint rules.
Answer from Jeff Demanche on Stack OverflowI am maintaining a very old ts project wherein I am setting up prettier and linter. Long story short, prettier flagged 2500 files. So, we decided not to run prettier --write in order to preserve history.
We have also setup eslint, for implementing other rules within the codebase including identifying import order issues. Now 2 situations:
If I turn off the plugin, prettier errors stop showing on the IDE (vscode)
If I turn it to either 'warn' or 'error', it shows up in vscode as an issue but it gets auto corrected by eslint --fix or when I save after setting the flag in .vscode/settings.json
Is there a middle ground where the errors will show in vscode but will not get overwritten by eslint --fix or during save?
Version 8.0.0 errors with "Extension 'Prettier - Code Formatter' cannot format" on all documents
Prettier does not format documents in latest Prettier + VS code versions
prettier 3.0 and prettier-vscode v10.1.0 won't load plugins
Why does Prettier not format code in VS Code?
Videos
- Select
File -> Preferences -> Settings(Ctrl+comma) and search formformatter - Set Prettiers as Default formatter.

If above does not work:
ctrl+shift+p > Format Document With... > Configure Default Formatter... > Prettier - Code formatter
This also work with ctrl+shift+I
If doing what @Simin Maleki mentioned does not solve it for you, there is a chance that your default formatter is not set:
File > Preferences > Settings > Search for "default formatter"
Make sure your Editor: Default Formatter field is not null but rather Prettier - Code formatter (esbenp.prettier-vscode) and that all the languages below are ticked. This fixed my issue.
STEP BY STEP WALKTHROUGH

Also make sure that your format on save is enabled:

Update:
Since writing the below, I discovered that it may be more economical to keep ESLint on with the following in settings.json:
{
// ...
"eslint.enable": true,
"eslint.run": "onSave",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"files.autoSave": "off",
// ...
}
- Enable ESLint and only run it on save.
- This avoids ESLint from reporting errors everywhere when you're writing code.
- Enable Prettier and have it format on save.
- ESLint will only check the file after Prettier has formatted it.
- Disable auto-saving features in VS Code.
- I choose to manually save because I can save it when I think the code doesn't have any syntax errors, which ensures that Prettier can format the file on save.
- VS Code automatically saves your edit session to disk, so even if you quit with unsaved changes or if something untoward happens, you'll restore session with the same unsaved changes next time. So auto-saving of files is not really necessary.
Note that if your entire project is not already formatted with Prettier, I suggest doing so using npx prettier --write ..
Original answer:
Quick Fix: Disable the ESLint extension in VSCode.
Explanation: These errors are generated by a lint tool, most likely ESLint.
It happens when you install both the eslint package as well as the "ESLint" extension in VS Code. The package checks to make sure the code is formatted well and throws errors if it's not. The extension runs the package seamlessly and dresses your VS Code window with those errors (hence the red squiggly lines). Good news is, you can have eslint package installed in your project without the extension. Prettier can still auto-format your code using the package without the extension.
Answer: If you have installed the ESLint extension, you can simply disable it, either by using the "eslint.enable": false or by finding ESLint in the Extensions sidebar and disabling it.
This Stack Overflow question has many answers which guide you on the matter.
Note: Prettier is not a lint tool. It's a formatter.
Bonus Tip: Run npx prettier --write . in your project to format all files according to your Prettier rules.
Another option is to disable to rule globaly in the ESlint plugin settings (in settings.json):
# other settings
"eslint.rules.customizations": [
{
"rule": "prettier/prettier",
"severity": "off",
}
]
You can open settings.json file like this:
Code -> Settings(or⌘,/ctrl,)- Click the "document icon" in the top right corner
Open Settings (JSON)