ZL
About Articles Contact
Published on Apr 28, 2021
Filed under:
#vscode,
#tools,
#javascript

Disabling languages for Prettier (in VScode)

It used to be straightforward to disable languages for Prettier in VSCode. You just added a prettier.disableLanguages setting and you were done.

// In settings.json
[
"prettier.disableLanguages": [
"javascript",
"javascriptreact",
"json",
"markdown"
],
]

Unfortunately, prettier.disableLanguages is deprecated so we can’t do this anymore. Here’s what we can do instead.

There are two methods.

  1. Enable Prettier in specific languages.
  2. Enable Prettier globally but disable it in specific languages.

Enabling Prettier in specific languages

The first option is to enable Prettier for specific languages you use. You can do this with the editor.defaultFormatter property. Here’s an example where you enable it for CSS.

[
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
]

If you use this method, you need to enable Prettier for every language, which can be tedious.

[
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
]

So I prefer to enable Prettier globally, but overwrite Prettier in specific languages.

Enabling Prettier Globally but disabling it in specific languages

We can enable Prettier globally with the editor.defaultFormatter property.

"editor.defaultFormatter": "esbenp.prettier-vscode",

If you want to disable Prettier for a specific language, you can set the editor.defaultFormatter to null.

"editor.defaultFormatter": null;

You can also choose to overwrite a specific formatter for a specific language. In the following example, I use Standard JS instead of Prettier for formatting JavaScript.

Note

If you’re using Standard for JavaScript, it’s much easier to use the prettier-vscode-standard extension instead. I wrote about this in another article.

"[javascript]": {
"editor.defaultFormatter": "chenxsan.vscode-standardjs"
},
Previous Why I stopped using Operator Mono Next Rsync with a custom port

Join My Newsletter

I share what I’m learning on this newsletter: code, building businesses, and living well.

Sometimes I write about technical deep-dives, product updates, musings on how to live, and sometimes my struggles and how I’m breaking through.

Regardless of the type of content, I do my best to send you an update every week.

If you’re into making things and growing as a person, you’ll probably feel at home here.

“

Zell is one of those rare people who commands tremendous knowledge and experience but remains humble and helpful. They want you to know what they know, not just be impressed by it.

In other words, Zell is a natural teacher. You’re lucky to have him because he feels lucky to be able to help you in your journey.

Heydon Pickering
Heydon Pickering — Web & Accessibility Extraordinaire
The Footer

General

Home About Contact Testimonials Tools I Use

Projects

Magical Dev School Splendid Labz

Socials

Youtube Instagram Tiktok Github Bluesky X

Follow Along

Email RSS
© 2013 - 2026 Zell Liew / All rights reserved / Terms