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 Best way to install Node and keep it up to date Next Never let anyone stop you from pursuing your dreams

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 I live, and sometimes my struggles and how I’m breaking through.

Regardless of the type of content, I do my best to send you at least one insightful piece every week.

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

“

Zell’s writing is very accessible to newcomers because he shares his learning experience. He covers current topics and helps all readers level up their web development skills. Must subscribe.

Chen Hui Jing
Chen Hui Jing — Web Developer
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