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

Viewed 1164
  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?

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 ^^ there is no mention of spacing prefs at all. So I'm assuming there are some defaults to double quotes.

Related