Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prettier VSCode. Single Quotes set, yet ALWAYS changes it to double

  1. Using Prettier extension in VSCode.

  2. Have the Single Quote set to single.

  3. format onSave is set to true.

Still... When I hit save, single quotes are converted to double..

WHY? WHY? WHY? WHY?


In addition...

  1. I've set eslint to use single quotes
  2. I've even deleted the eslint extension from VSCode.
// in .eslint file
"quotes": [2, "single", { "avoidEscape": true }],

Still... When I hit save, single quotes are converted to double..

WHYYYY?

like image 627
GN. Avatar asked Oct 19 '25 10:10

GN.


1 Answers

I've traced the source of the problem.

It appears there are levels of configuration that will be checked when VSCode attempts to reformat the text when format on save is checked.

  • Prettier extension config
  • .eslintrc
  • .editorconfig

I'm still not sure in what order they run in, thus who has the final say.

But in my case, a VERY basic .editorconfig was the problem. Deleting this file fixed it.

# EditorConfig https://editorconfig.org/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_size = 2
indent_style = space
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

In the file above there is no mention of spacing prefs at all. So I'm assuming there are some defaults to double quotes.

like image 179
GN. Avatar answered Oct 22 '25 03:10

GN.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!