Every JavaScript survey I've ever seen shows that most developers prefer single quotes for literal strings.
Most of popular languages (go, C#, java, C, C++, rust) strictly uses double quotes, why should there be an exception? 🤔 (python uses both)
| Language | Double quotes | Single quotes
|-----------|---------------|--------------
| go | Yes |
| Python | Yes | Yes
| C# | Yes |
| java | Yes |
| C | Yes |
| C++ | Yes |
| rust | Yes |
| Lua | Yes | Yes
| Name | Language | Quotes
|-------|-----------|--------
| Black | Python | Double quotes (discussion)
| Language | Double quotes | Single quotes
|-----------|---------------|--------------
| CSS | Yes | Yes
| HTML | Yes | Yes
| Language | Double quotes | Single quotes
|-----------|---------------|--------------
| JSON | Yes |
| YAML | Yes | Yes
| GraphQL | Yes |
| XML | Yes |
| Guidelines | Quotes
|-----------|--------
| Airbnb | Single quotes
| Google | Single quotes
| React | Single quotes but Double quotes for JSX properties
| TypeScript | Double quotes (for Contributors)
| Vues.js | Don't mind
| jQuery | Double quotes
| Node.js | Single quotes (for Contributors)
| Deno | Double quotes
See also how console outputs
| Console | Quotes
|-----------|---------------
| Chrome | Double quotes
| Firefox | Double quotes
| Edge/IE | Double quotes
| Safari | Double quotes
| Node.js | Single quotes
| Deno | Double quotes
Because single quotes are less noisy.
At least 50% less noisy :)
This is from the Google JavaScript Style Guide
Use single quotes
Ordinary string literals are delimited with single quotes ('), rather than double quotes (").
Both Airbnb and Google style guides use single quotes. Switching this to default would be quite sensible, since a lot of companies/devs use their guides.
A large reason for single quotes being common in JS compared to other langauges is that it reads well when quoting HTML and some selectors.
For example:
document.querySelector('[data-foo="bar"]')
The alternatives are to:
@a118n alright I've updated my post with those informations 😉
In addition to @craigmorrison 's comment, big JavaScript frameworks, such as Angular and Vue, often contains JavaScript implementation inside HTLM attributes.
// Vue example
<button @click="submit('string value')">Submit</button>
// Angular example
<button (click)="service.submit('string value')">Submit</button>
For such a case single quotes must be used in order to avoid interference with HTML's double quotation. The important part is how JavaScript is used, not what other languages use.
I strongly recommend single quotes to be used.
Given that Prettier now supports plugins (python, php, swift, elm, java, pg, ruby) and most of the languages use double quotes (see comment above), won't a switch cause more harm and ambiguity than benefits?
Agree that single quotes are 50% less noisy and was preferring them for a couple of years after looking at the airbnb style guide. Now using double quotes in JS and TS files again simply because that's Prettier's default and can't say it's terrible. On a positive side, the quotes are the same in JS and JSON, which means one less modality to deal with.
Airbnb ang Google style guides are _JavaScript-only_, while Prettier is slowly becoming a cross-language tool. IMO this needs to be taken into account when making the final decision for 2.0. And, of course, the diffs that zero-config users would have is also something worth thinking about.
There's also the "avoidEscape" setting in eslint, which is pretty useful for readability, be it with single or double quotes.
That’s already what we do @brocoli and I agree that it’s helpful.
The new Python formatter "black" uses double quotes: https://github.com/ambv/black/#strings. Discussion: https://github.com/ambv/black/issues/118
I think holding to already-established standards is a best-practice. For many languages, single quotes are reserved for a single character and double quotes are reserved for strings. While I love double quotes within JavaScript, that's the only language I like it in.
As a hypothetical new user of Prettier, I wouldn't be all too happy if I ran Prettier against a language that requires double quotes for strings and causes compiler errors. While JavaScript will play nicely, along with other languages, the cost of breaking other languages is too high, in my opinion. Just my perspective. I'm not sure how many languages will support in the future or if the list on the website is a "final" list of support for different languages but I'd rather see language-specific requirements being catered to over personal preference. 😄
I'm not a contributor so I probably lack a lot of authority in saying that. Just trying to think of the long game!
(The best example I can show is using Prettier against a _hypothetical_ support of C++. It would be incredibly painful to undo all of those single quote changes, especially in larger projects. Image AAA game developers who could potentially run Prettier against their codebases. Even undoing changes from git is an extra process and is not a suitable catch-all.)
@iamclaytonray Don’t worry — we’d never intentionality break your code. If the language only supports double quotes, we’ll print double quotes. Since Prettier isn’t a general formatter (we need to manually add support for each new language), there shouldn’t be issues with quotes being changed illegally.
So is there a way to override the double quote default? I'm tearing my hair out trying to get this working. It totally breaks all of our style rules.
@mvolkmann Thanks for the quick response. I've been toying with that but I'm not seeing it work. Here's my setup, with the ugly red circles being points of configuration. All packages are up to date and listed at the bottom. If you could take a look, I'd really appreciate it. Anything look funky here?

"eslint-config-prettier": "^4.1.0",
"eslint-plugin-prettier": "^3.0.1",
"prettier": "1.14.3",
"tslint-config-prettier": "^1.18.0"
@dandonahoe Could you open a new issue for your problem? Ideally with a reproduction on the playground (https://prettier.io)
@dandonahoe I've never seen the approach you are using where reading your .prettierrc file inside your .eslintrc file. I thought it was enough for the .prettierrc file to be present.
I have a pretty detailed description of the way I configure ESLint and Prettier at https://github.com/mvolkmann/talks/blob/master/eslint-prettier-2019.key.pdf. Maybe that will help.
@mvolkmann That approach is meant to solve two use cases.
1 - Allow the IDE to read the .prettierrc
2 - I have a pre-commit git hook that lints staged files, but that only reads the .eslintrc.js, so sucking in the .prettierrc means I only have to add prettier rules in one spot.
Not my idea, but based off this boilerplate: https://github.com/react-boilerplate/react-boilerplate
I wonder why the IDE can't get the Prettier settings from .prettierrc. I
use VS Code and it does that.
On Thu, Mar 7, 2019 at 8:14 AM Dan Donahoe notifications@github.com wrote:
@mvolkmann https://github.com/mvolkmann That approach is meant to solve
two use cases.1 - Allow the IDE to read the .prettierrc
2 - I have a pre-commit git hook that lints staged files, but that only
reads the .eslintrc.js, so sucking in the .prettierrc means I only have
to add prettier rules in one spot.Not my idea, but based off this boilerplate:
https://github.com/react-boilerplate/react-boilerplate—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/prettier/prettier/issues/4102#issuecomment-470540813,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAE10MqdDBf63hSqBtq7ovPS84Xljqa9ks5vUR6ugaJpZM4ScMrl
.
--
R. Mark Volkmann
Object Computing, Inc.
@mvolkmann I use VS Code as well, but as you mentioned, I'll open a separate issue so I don't pollute this one. Thanks again.
https://github.com/airbnb/javascript/issues/269#issuecomment-107319162:
Holding down the shift key every time you want a string kinda stinks. Your carpal tunnel will thank you for using single quotes.
@tkrotoff That’s not a good argument in the context of Prettier. Because with Prettier you can type either " or ', whichever you want, and then when you run Prettier the quotes are automatically changed.
I guess this is not a candidate for inclusion in 2.0 (#6888), right?
@karlhorky looking at the comments, there seems to be no consensus on this one. Guess it would not be wise to get such a massive change through in the last minute before 2.0 is out.
it would not be wise to get such a massive change through in the last minute before 2.0 is out
Hmm, there are still a number of open PRs that will land before 2.0 (which are also big changes to defaults), so I'm unsure that this argument holds water.
there seems to be no consensus on this one
This is more of an issue, surely, although there are a lot of positive signs already:
👍 @j-f1
👍 @lipis
Maybe more of the Prettier team can chime in on changing the default on this one. cc @suchipi @thorn0 @evilebottnawi @lydell @prettier/core
:+1: on single by default
I’d prefer if all programming languages converged on double‑quotes, including JavaScript.
I would personally prefer consistency across languages too, but that's a bigger fish to fry - JavaScript (including the ecosystem) is different in many ways to other languages, and a JavaScript tool needs to embrace that.
I've opened a PR at #7466, just in case this will get the approvals that it needs.
git diff.So I’d say we follow black’s lead and stick with the double quotes. Personally, I program a lot in Elm and F# these days which do not allow single quotes for strings, so I’m really used to double quotes now. Before I learned JS I learned HTML and CSS where double quotes is really common.
- trailingComma es5: Makes code easier to edit and produces better
git diff.- arrowParens always: Makes code easier to edit. Especially good for TypeScript.
- eol lf: Helps collaboration across OS:es.
- singleQuote: 100% bike shedding.
So I’d say we follow
black’s lead and stick with the double quotes. Personally, I program a lot in Elm and F# these days which do not allow single quotes for strings, so I’m really used to double quotes now. Before I learned JS I learned HTML and CSS where double quotes is really common.
Always keep in mind that this changes the default setting and does not force you to change it in the configuration file
How would you motivate the change in the 2.0 blog post?
How would you motivate the change in the 2.0 blog post?
@lydell I've started a bit of the "motivation" explanation in the unreleased changelog file in the PR here:
The JavaScript ecosystem has largely standardized on single quotes, with it being the most popular style seen in the wild.
https://github.com/prettier/prettier/pull/7466/files#diff-6afbd7a88bf7df26bba2e36de87663ffR16
I also further expanded on this in the answer to you in the PR:
https://github.com/prettier/prettier/pull/7466#issuecomment-579875882
If this should be fleshed out more for the 2.0 blog post, maybe some others could help out? I could also do some further writing here.
Ok, so maybe the supporters here can pull together and help me with some statistics:
@lydell has asked for some justification of the "most common" statement in the other pull request, so let's pull together and get some examples!
Here are my ideas for some examples of sources:
I will also take a look this evening.
Project | Dominant quote style
-- | --
async | ' - 76% of quotes
express | ' - 92% of quotes
lodash | ' - 73% of quotes
request | ' - 97% of quotes
underscore | ' - 78% of quotes
angular.js | ' - 58% of quotes
react | ' - 52% of quotes
I went to the documentation websites of many popular JavaScript libraries to see what kinds of quotes that I would find in the examples.
I included both older, popular libraries as well as newer ones.
Show Screenshots























- moment: mixed
Show Screenshots



TODO
TODO
TODO
TODO
I tried to find survey results on this and struck out. The closest I could find is this: https://2ality.com/2012/09/javascript-quotes.html
R. Mark Volkmann
Object Computing, Inc.
@mvolkmann that's 2012, which is nearly a decade ago. Using references of this quality, we can also 'prove' that no-semicolons is better than semicolons. That's what standard.js does in their docs:
↓
🙂
Maybe Prettier should run its own 2020 poll on this and any other topics being considered.
Maybe Prettier should run its own 2020 poll on this and any other topics being considered.

I tried to find survey results on this and struck out.
@mvolkmann All good, we might find something if we keep looking.
If not, there are enough other sources to be overwhelmingly convincing.
@lydell Thanks, added.
@Shinigami92 I don’t think that referring to the reactions for this issue is the right way to decide if the change should be done in v2.0.
In general, I don’t think that Prettier should pick defaults just based on what’s currently popular. It’s mission is not to follow some fashion, but rather to decide what’s fashionable. None of the other default value options were changed based on stats. Instead, the guiding principle was a better developer experience, aiming for fewer ugly edge cases. Arrow function parentheses, semicolons and new lines are great examples here.
I don’t see how changing default quotes to single would improve DX (except for resulting less ‘ink’, which is good, but not enough to qualify). Objectively, it’s probably the opposite:
If you are a completely new developer who just starts coding, would you really appreciate the ‘cleanness’ of single quotes? Or would it just give you an extra headache while learning?
If the entire community is doing something for many years, it does not mean that this cannot be challenged or that it does not need to change. This can apply to Prettier’s defaults, but can also mean questioning widely seen code styling preferences.
To sum up, I’d suggest postponing the decision and call for a proper research, which would not just involve votes by JS ‘veterans’ (who are experienced enough to discover the github issue or start their own open-source repo l). This is still quite a small proportion of the entire community of devs.
jsxSingleQuotes is its own attribute! And it should stick to default false!!!
const greeting = 'Hello, world!';
const element = (
<h1 className="greeting">
{greeting}
</h1>
);
@Shinigami92 I don’t think that referring to the reactions for this issue is the right way to decide if the change should be done in v2.0.
- The poll is nearly two years old and some opinions could have changed
- People may be generally pro single quotes, but think that the right time for a change is v3.0 and not v2.0. At the time of writing this comment, the milestone for this issue is v3.0.
Sorry, that was actually a bit trolly
But I think we have now found some statistics and repositories that use single quotes
@Shinigami92 imagine I’m a new developer, today is my first lesson on JSX. I feel pretty overwhelmed because even JavaScript alone feels too much for me. I also heard of JSON, but I’m not sure what that is yet.
Could you please explain why you have a mix of quotes in your above example? Which ones are right where? Note that the simplicity and clarity of your answer may affect my whole career. I’m still not sure if I’m ‘smart enough’ to do programming.
If we are targeting v3.0
I would prefer something like
{
"quoteStyle": {
"single": ["js", "ts", ...],
"double": ["html", "pug", "jsx", "tsx", ...]
}
}
@Shinigami92 imagine I’m a new developer, today is my first lesson on JSX. I feel pretty overwhelmed because even JavaScript alone feels too much for me. I also heard of JSON, but I’m not sure what that is yet.
Could you please explain why you have a mix of quotes in your above example? Which ones are right where? Note that the simplicity and clarity of your answer may affect my whole career. I’m still not sure if I’m ‘smart enough’ to do programming.
😆 ... OK
JSX is HTML embedded in JS
HTML most common use double quotes for there attributes
Objectively, it’s probably the opposite:
- inconsistency between js and other languages like json, jsx, html, css and those supported by Prettier plugins
- Difficulties searching for something in your codebase (a need to search twice or write a regexp, which covers both " and ').
If you are a completely new developer who just starts coding, would you really appreciate the ‘cleanness’ of single quotes? Or would it just give you an extra headache while learning?
Counterpoint, especially for new developers:
Comparing code examples (in the same language) with your code. This is a big use case for developers, and quotes can be confusing. I have seen this multiple times first hand while training developers.
Comparing between different languages is not very common, so the inconsistency argument doesn't really hold.
imagine I’m a new developer, today is my first lesson on JSX. I feel pretty overwhelmed because even JavaScript alone feels too much for me.
New web developers unfortunately learn three languages: HTML, CSS and JavaScript, each with their own idiosyncrasies. There are a lot of differences between these languages, which they will learn over time. JSX is pretty much learning HTML - they will learn HTML probably long before learning JSX, and even if not, the learning path for JSX is pretty much the same for a lot of it - you need to know what these elements are doing.
I don’t think that Prettier should pick defaults just based on what’s currently popular
If the entire community is doing something for many years, it does not mean that this cannot be challenged
call for a proper research
@kachkaev This seems a bit trolly, but I'll give you the benefit of the doubt - that you really just want the best solution and not just that your opinion wins.
What do you recommend for proper research? I have started a list above from many different sources, which are overwhelmingly showing that single quotes is the most common style.
Not only that, but that double quotes are uncommon.
Even putting aside my point above about comparing code, which helps new developers - since single vs double is largely a personal choice, it seems like Prettier should not choose an uncommon style.
What do you recommend for proper research? I have started a list above from many different sources, which are overwhelmingly showing that single quotes is the most common style.
A list of repos and guidelines using single quotes is a useful start. However, it only answers what's popular in the today’s open source community rather than what’s the simplest and the most inclusive choice for the entire JS dev world.
A proper research would first of all mark every repo and a style guide with a year when a decision for quotes was made. Besides, a proper research would include a bunch of interviews with a wide range of developers. Can it be that some style guide authors feel being hostages of their own past decision after so many years? Do they regret or are they still happy? What about new developers? Is a mix of quotes an issue for them as I’ve suggested or is it not the case? How about people with accessibility needs (e.g. visually impaired)? What’s best for them?
Given that single quotes are currently indeed a popular choice in the open source JS community, asking ‘rebels’ is also vital. Why did TypeScript folks go for double quotes, clearly knowing that they’d be a minority? Was it simply because of the current (possibly wrong) Prettier default option value? Or was there something else? How about browser vendors, who choose to print double quotes in the console? What about deno (a potential successor of Node.js)? Are they just following the style from TS docs, which is based on the (possibly wrong) Prettier default option or did they run their own research? How long ago did they decide to go for double quotes? What did the decision making process look like? How confident and happy do they feel now?
This may sound like too much, yet I believe that the popularity of Prettier and the longevity of consequences justify such scale for what would be a ‘proper research’. If a topic a controversial, it cannot be resolved by a mob. Imagine we would live in a world where the most common decisions are named the right ones and are never challenged. We’d still be curing diseases with leeches instead of antibiotics because at some point ‘according to research, leeches are the most common choice among all doctors in all developed countries’ 🙂
A proper research would first of all mark every repo and a style guide with a year when a decision for quotes was made. Besides, a proper research would include a bunch of interviews with a wide range of developers. Can it be that some style guide authors feel being hostages of their own past decision after so many years? Do they regret or are they still happy? What about new developers? Is a mix of quotes an issue for them as I've suggested or is it not the case? How about people with accessibility needs (e.g. visually impaired)? What’s best for them?
This may sound like too much
Yes, this does sound like too much. It sounds like a research paper.
If a topic a controversial, it cannot be resolved by a mob
It's not a mob. It's the collective common choice of the ecosystem.
As I mentioned above, the first decision was based on a single person's choice, which the Prettier team fairly quickly afterwards wanted to reverse.
Now this decision is based on a researched, common thread in the JavaScript ecosystem - visible since years.
This is already a step up, and is way more justified of a decision for a default for a tool than normally done.
This is not taking away the option to write your code with double quotes! Just making it more zero-config for most people.
FWIW, do we have any stats on what % of prettier users on GH override the default to use single quotes? I'm not really opposed to this change but if most prettier users stick to the default, I'd think the change is disruptive given how widely prettier is already used (most people I know had a migration path where they first started using prettier with their own overrides and then got rid of the overrides and just stuck to the defaults).
I'm not convinced changing the default will help adoption, so "what's most common among people who don't use prettier" doesn't seem the right question to ask for a change that may affect literally billions of lines of code across the ecosystem. If there's already a notable majority of prettier users using single quotes, I'm +1 on making it the default tho.
I'm sorry @karlhorky but I don’t think you heard what I was trying to say in my previous comment 😔
Instead of addressing the questions I raised, you are repeating the same arguments that have been mentioned in this thread many times. I am aware of them and I’m not challenging their importance, I’m just suggesting that there is more depth to the topic and hence the responsibility in the hands of those making decisions on it.
So far, all the pro-single-quote arguments boil down to ‘social proof’ and ‘authority’ – same persuasion tactics that are commonly used in ads to make people buy things that turn out harmful. The only one that does not fall into this category is ‘less noise’, which is purely subjective (bike shedding). These points alone are not enough to make a scientific conclusion about what’s best for the future of the JS ecosystem, which is a Prettier’s responsibility to a degree.
At this point you might be thinking that I just _want double quotes at all costs_ and there is no way I can start supporting another default value. I’m not this kind of person, as you can see from a discussion in https://github.com/prettier/prettier/issues/6931. The only thing I’m arguing for here is to use an in-depth scientific method when making important decisions and not only the methods used in commercial ads. If the questions that go beyond the current popularity of quotes are answered and the conclusion is to use single quotes, I’m totally fine with them. Subjectively, I feel zero irritation seeing any quotes in the codebases I’m working on. 🤷♂️
all the pro-single-quote arguments boil down to ‘social proof’ and ‘authority’
There are a number of arguments that don't quite boil down as you mention. Let me post the current list
Single quotes are more common. This will make Prettier more zero-config for the majority.
Additionally:
- make it easier for beginners to compare their code with examples
- votes in #4102 (👍 114, 👎 21)
- a reference to style guides and popular open-source repos
- many other sources from my review of the ecosystem
- the original decision was made based on a single person's opinion
- 191 likes in 18 hours on Twitter
- supporting Prettier members below
I'm not convinced changing the default will help adoption
@pluma Adoption is not part of the goals of this change.
do we have any stats on what % of prettier users on GH override the default to use single quotes?
the change is disruptive
Not sure if there is this data anywhere, would also like to see the numbers.
Regardless though, in case people have an opinion that they'd like to stick with double quotes after the major version bump, it's as easy as a 30-second commit of adding a single line / single file. So it doesn't need to be disruptive
Github tells us there are 1.3m repos using prettier, if anyone was motivated enough we could scrape that list of packages and find out:
Then we'd have an indication of just how disruptive this change would be.
This might open a different question concerning how such an strongly adopted library should stay open to changes.
In my opinion 200 likes on Twitter or GitHub are hardly a good evidence to possibly change the defaults of a library responsible for formatting millions of repos.
That's not an argument against single quotes (I personally prefer them), but this would set a precedent for introducing further breaking changes on the basis of a momentary enthusiasm or a bunch of likes.
We all want JS to live in a stable and reliable ecosystem.
I'm the author the referenced byte archer quotes vs single quotes article. I've just re-run the stats on the most dependent-upon npm packages and here are the latest numbers:
| Project | Dominant quote style |
| ------------- | ---------------------------------- |
| lodash | '- 99% of quotes |
| chalk | '- 100% of quotes |
| react | '- 90% of quotes |
| request | '- 97% of quotes |
| commander.js | '- 97% of quotes |
| moment | '- 90% of quotes |
| express | '- 92% of quotes |
| tslib | "- 100% of quotes |
| debug | '- 97% of quotes |
| node-fs-extra | '- 98% of quotes |
| axios | '- 81% of quotes |
Looks like single quotes still dominate.
There are some developer experience issues to using single quotes that I haven't seen mentioned here.
JSX, HTML and JSON all use double quotes for strings. This means that when you copy paste a string or an object with a string it will change everytime you copy it, which is a bit jarring.
It also makes refactoring in JSX a bit more involved for example:
function someComponent(){
const id = "thing";
return <div id={thing} />
}
I can simply copy and paste directly from the js variable to the html tag attribute. But if we use single quotes:
function someComponent(){
const id = 'thing';
return <div id={thing} />
}
I have to change the quotes when refactoring the code.
A similar thing happens with JSON with string values and string property names.
Not really that much of an issue though, especially since prettier formats code automatically so you don't have to do anything - it's much more annoying in things like eslint that requires manual changes (if you don't use autofix etc...)
when you copy paste a string or an object [from HTML, JSX or JSON] with a string it will change everytime you copy it, which is a bit jarring
It has been mentioned over here: https://github.com/prettier/prettier/pull/7466#issuecomment-579973995
Yes, that this is jarring is a small downside.
However, I would argue that this small downside is outweighed by having the code in the same style as the most common style, especially for new developers. I mentioned that in the list:
- make it easier for beginners to compare their code with examples
In my opinion 200 likes on Twitter or GitHub are hardly a good evidence
@toomuchdesign You have glossed over all of the rest of the reasons. This change has been a goal of the team for a long time.
this would set a precedent for introducing further breaking changes on the basis of a momentary enthusiasm or a bunch of likes
Maybe take a look at some of the other breaking changes (changes to defaults) that have already made it into Prettier 2.0 (a few of them from @kachkaev):
https://github.com/prettier/prettier/issues/6888#issuecomment-572570924
The precedent of doing long-overdue breaking changes in major releases is already pretty expected in software.
It doesn't make sense to write academic papers about changes to defaults in a tool.
There is research being done in this thread about the current state of the ecosystem - that's much more than happens normally.
Github tells us there are 1.3m repos using prettier, if anyone was motivated enough we could scrape that list of packages and find out:
- The percentage of packages which have no prettier config at all
- The percentage of packages which set the single quote option.
Then we'd have an indication of just how disruptive this change would be.
@phpnode Yeah, that's a good idea!
Also add in the following important metrics (just off the top of my head):
Then you can more accurately judge the level of disruption.
I think semver is a bit of a red herring here because a lot of prettier's usage comes from IDE integrations and extensions which auto update. Those users are going to see a pretty noticeable change in their editor's behaviour, for reasons that are hard to justify.
The goal of scraping existing repos that use prettier is not to determine whether single quotes or double quotes are more popular, it's to determine whether the assumption that this change will result in fewer people needing to configure prettier holds true. I pretty strongly suspect the opposite is the case.
a lot of prettier's usage comes from IDE integrations and extensions which auto update. Those users are going to see a pretty noticeable change in their editor's behaviour, for reasons that are hard to justify
Interesting, can you confirm this fact of auto-updating to a major version is true for the major editor plugins (VS Code, Sublime, anything Jetbrains, Atom, etc)?
The recommended way of using Prettier with the VS Code plugin is to have a version in your project. Of course that doesn't mean that people don't ignore that.
I guess with the editor plugins we have some interesting properties:
I was also thinking of this possibility as a post-install step for installing the package in a project.
The goal of scraping existing repos that use prettier is not to determine whether single quotes or double quotes are more popular, it's to determine whether the assumption that this change will result in fewer people needing to configure prettier holds true
Yep, I didn't mean that the goal was to determine the popularity.
I meant that in order to determine whether this assumption is true or not, you have to measure those other properties too. The projects that were just started at one point in time and are never updated or never do these types of updates should not change the results of the "who needs to configure Prettier". Staying on v1 and not configuring is still "not configuring".
I'm rethinking about this 🤔
Do we want single quotes by default? Or do we want single quotes for JS by default?(!)
Many programming and other languages do not support single quotes...
We may think about in which direction do we want to go
Format JS (JSX, TS ...) or format and support any language out there (C#, Kotlin, Python, Go, Rust ...)
Edit: I know that this will be also possible with the change, but I'm thinking about to provide a better way of configuration to all this consumers
Also, several languages use single quotes for raw strings and double quotes for strings with escape characters.
Examples being: bash and PowerShell.
I think people would be very disappointed if CSS and HTML suddenly defaulted to single quotes, because as far as I understand double quotes is the norm in those languages. _If_ we change the defaults for quotes it should only be for JS/TS. My vote is: Single quote seems to be more common in big JS projects, but let’s keep things simple – the singleQuote option always has the same default value of false.
@lydell So after 2 days (and a bit) I changed my mind...
I will reject my vote on this topic and downvote (for v2.0)
@Shinigami92 Do we want single quotes by default? Or do we want single quotes for JS by default?(!)
Excellent question. And yes, definitely - single quotes to be default for the JS/TS ecosystem. Nearly everyone is using single quotes, and for a reason. It's backed by giants, by the most and very wide variety of style guides, and by millions of downloads per week/month.
But also has empathy about this frustration. When I jumped more on JS back in 2013-2014 and started to use more and more npm and then ESLint, I really hated why JS differs in that.. while 90% of the languages are using double quotes. After some time adopted the Standard style (big mistake, it's simple but it doesn't use a looooooot of rules and is practically nothing), then I so much used to no-semicolons, that I hated other languages requiring them. After short time I jumped on Airbnb (requires semi), using it for 4-5 years everywhere and I'm really glad with it - at least not complaining why other (the normal) languages require semi :laughing:
So...
So after 2 days (and a bit) I changed my mind...
I will reject my vote on this topic and downvote (for v2.0)
Thanks for the update @Shinigami92, I have changed your vote on the PR: #7466
Can you expound on the factors leading to your change in decision and why you think that it is a better decision to leave the default as it is now? Is it mostly to avoid the complexity of Prettier only formatting to single quotes for JS and not other languages?
@tunnckoCore
Well, JavaScript not requiring semicolons is a footgun and a legacy mistake, as it makes it much, _much_ more difficult to introduce new syntactic improvements (ex.: https://github.com/tc39/proposal-export-default-from/issues/2), and the @TC39 does agree with this in https://github.com/tc39/ecma262/pull/1062, but it’s three decades too late to fix.
Can you expound on the factors leading to your change in decision and why you think that it is a better decision to leave the default as it is now? Is it mostly to avoid the complexity of Prettier only formatting to single quotes for JS and not other languages?
So as I said in https://github.com/prettier/prettier/issues/4102#issuecomment-580127727
I would prefer if prettier grows to a size to format any programming and other languages
The setting singleQuotes: true is missleading when you use prettier to format java code and all quotes stick to double quotes cause there is no single quote supported in java
Also html, css, pug, jsx, tsx and other languages use (should use) double quotes
Only js and ts should use the common case of single quotes
My plugin currently rely on the singleQuote setting https://github.com/prettier/plugin-pug/blob/master/src/index.ts#L73
And I already have problems with it (https://github.com/prettier/plugin-pug/issues/45) when using mixed quotes like using js code in pug
So the ultimativ way would be to use singleQuote: true in js, pugSingleQuotes: true in pug and pugJsSingleQuotes: true for js in pug 😨
... And currently I said no to my customers ...
So we should think about a better configuration structure for v3
we should think about a better configuration structure for v3
Such as #7073
Has anyone suggested to remove this option entirely? Since this is a breaking change, this might be a good time to just remove it.

True. I agree that it lost its "opinionated" face, almost entirely.
But in same time single quotes and spaces are by far the most used style in the entire JavaScript, for years, that's why they could have been the default ones from the day one, or at least in next major.
But hey, completely understand the people that are against these two. And they are right for a good reason - JavaScript is the most different in style compared to other languages. In the beginning I was almost constantly asking "why the heck". But hey, now I like and love single quotes, spaces and semi-colons (holy cow thanks to constant ESLint autofix not that I'm caring at all), and feel that that's the JavaScript's origins.
Not to mention that these people that are against such style, are not the majority in JavaScript. Almost everything (and very popular projects and people) found in GitHub/BitBucket/GitLab as JavaScript and its flavors is using exactly this style.
But also remember this that "opinionated" doesn't always mean that you must be against the majority. Meaning that it's more meaningful to be useful for the majority and still be opinionated - which in turn will mean it will be strict in configuration and inclusions/edits.
If Prettier wants to strive towards general language formatting it must accept per-language configuration similar to editorconfig
@jchook It does: https://prettier.io/docs/en/configuration.html#configuration-overrides
It does: https://prettier.io/docs/en/configuration.html#configuration-overrides
What @jchook means is that it has to be much more intuitive and does not prefer javascript as the default
(#7073)
In my opinion, it's also important to note that you should not ruin the experience of JS devs for the price of supporting other languages. What type of quotes used for JS should not be impacted by other languages.
Start removing options and enforce a certain standard to end debates like this. This is an issue about single quotes or double quotes for strings. With 83 comments and open for almost 2 years now. The benefit of prettier is to end debates like this around options. A decision that can't be made in 2 years is not a decision that should be allowed to be done by dev teams.
On the other hand, I could starting showing evidence by citing resources showing that both single and double are wrong and we should start implementing template literals(which is my preference) instead which could possibly take this into a much longer conversation but that all defeats the point of prettier imo.
Why does prettier still have this option? Pick one and end the debates around quotes by removing the option.
The option to remove is too radical! Prettier would lose customers
(If the only option were double quotes, I wouldn't use Prettier anymore)
Using backticks as a standard is dangerous in two ways:
'${text}' !== `${text}`
'${text}' === `\${text}`
I think we should definitely consider at least adding a backtick option since it is more consistent, quite easy to type, and there are already some places Prettier changes AST node types.
Also, backticks are different enough from the other quote types that it’s possible to justify a switch, whereas that isn’t true for single or double quotes.
Even with a backtick option you still need to choose quote style for object keys, imports and use strict.
@Shinigami92 I don't believe it is radical I believe that is prettier's very own philosophy. The entire selling point of prettier is that it doesn't care how you prefer your code.

The case you make that "if the only option was x, I wouldn't use Prettier anymore" where X could be any option, is flawed in my opinion. Prettier's job is to get rid of options. This is saying the Prettier philosophy is wrong and Prettier should have options for everything(which i strongly disagree with btw) because not having options makes people not use prettier.

Should Prettier start adding options for every possible thing? The more options the more customer prettier can get! Right? No, this is bad logic and goes against what Prettier stands for.
I personally prefer template literals to be used for my strings, should I then leave Prettier? Should I use dprint which is Prettier with better performance but with options? No! I love prettier for removing options. Having options makes prettier worse, evidenced by this issue itself of a 2 year long debate of single vs double quotes.
Single quote, double quote or template i don't care what prettier uses I am happy with whatever. My preference is templates. If prettier decides to enforce single, that is 100% okay. Pick one and enforce it. Thats the Prettier way!
@j-f1 Although I would love for Prettier to use backticks, I don't believe there should be an option for it. That defeats the point of prettier. Say no to ~drugs~ options!
P.S. I think it is worth having a convo about whether Prettier should enforce templates instead of single/double but that is outside the scope of this issue imo. The reason I pointed out the possibility of backticks is to show that Prettier takes a stance to say sorry we're not going to support that. Prettier reason for existance is to remove options. It is opinionated and I love it for that. Why not do the same for this option.
Most helpful comment
Every JavaScript survey I've ever seen shows that most developers prefer single quotes for literal strings.