-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change default of singleQuote to true #7466
Closed
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f2ee3d2
Change default of singleQuote to true
karlhorky a71d126
Rename file
karlhorky e858673
Change option in common-options
karlhorky 8ba5d74
Merge branch 'next' of https://github.com/prettier/prettier into defa…
karlhorky 8f2fd39
Update snapshots, fix some hardcoded strings
karlhorky 6d18a88
Add newline at end of file
karlhorky 58eb66f
Add back quotes sentence to rationale
karlhorky d0647dc
Fix test
karlhorky e3a16f5
Fix tests, update snapshots
karlhorky 66284c0
Fix test
karlhorky 39cd51c
Fix snapshots
karlhorky 85e54ed
Fix snapshot
karlhorky d7cd2d6
Fix snapshots
karlhorky c1fd013
Fix snapshot
karlhorky 5d2304c
Fix wording
karlhorky File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#### Change default value for `singleQuotes` to `true` ([#7466](https://github.com/prettier/prettier/pull/7466) by [@karlhorky](https://github.com/karlhorky)) | ||
|
||
[Since version 0.0.1](https://github.com/prettier/prettier/commit/599b4311bb6be9204689a7725d37d6fdfca770aa), Prettier has an [option](https://prettier.io/docs/en/options.html#quotes) to use single quotes instead of double quotes. | ||
Since version 2.0, the default of this option changes from `false` to `true`. | ||
|
||
<!-- prettier-ignore --> | ||
```js | ||
// Input | ||
const foo = 'bar'; | ||
// Prettier stable | ||
const foo = "bar"; | ||
// Prettier master | ||
const foo = 'bar'; | ||
``` | ||
|
||
The JavaScript ecosystem has largely standardized on single quotes, with it being the most popular style seen in the wild. | ||
|
||
If the old behavior is still preferred, please configure Prettier with `{ "singleQuotes": false }`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
People are going to ask for sources on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, interesting perspective - I think they won't. I think that most JavaScript developers have already had this experience of single quotes being the norm by trolling through documentation and examples from all over the place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it's not about your opinion or my opinion, so maybe we can get some statistics together on this!
Some sources:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will ask for some help in #4102.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I write JS every day, and I honestly have no clue what’s the norm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will continue my research (and get some other people to help too). Single quotes are almost everywhere, so collecting them isn't tough to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Microsoft is really the only counter-example I can think of. They use doubled quotes.
The typescript source code: https://github.com/microsoft/TypeScript/blob/master/src/tsserver/server.ts
The typescript documentation: https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@styfle Thanks! I've added this to the list:
#4102 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karlhorky Maybe you could move the content of that comment into the original post because github auto-collapses comments in the middle so its unlikely someone will see that who is just finding this PR (like myself).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I moved it yesterday already actually, under the link text "my review of the ecosystem"