Settings for forcing/prefering single/double quotes for strings
See original GitHub issueJust a setting so quoting style can be unified across a codebase.
e.g.
for the three strings abc
, a'c
, a"c
prefer_single_quotes
-> 'abc'
, "a'c"
, 'a"c'
prefer_double_quotes
-> "abc"
, "a'c"
, 'a"c'
force_single_quotes
-> 'abc'
, 'a\'c'
, 'a"c'
force_double_quotes
-> "abc"
, "a'c"
, "a\"c"
Issue Analytics
- State:
- Created 6 years ago
- Reactions:195
- Comments:26 (8 by maintainers)
Top Results From Across the Web
How to tell eslint that you prefer single quotes around your ...
Another useful option is to allow single or double quotes as long as the string contains an escapable quote like "lorem ipsum 'donor'...
Read more >“Double Quotes” vs 'Single Quotes' vs `Backticks` in JavaScript
The same theory applies to double quotes, and you have to use a backslash to escape any double quotes inside double quotes.
Read more >prefer_single_quotes - Dart
DO use single quotes where they wouldn't require additional escapes. That means strings with an apostrophe may use double quotes so that the...
Read more >Prefer single quotes over double quotes for strings, in a ...
Be consistent with your choice of string quote character within a file. Pick ' or ” and stick with it. However, in a...
Read more >Super important question… do you prefer “ or ' to enclose ...
They match the docstring standard described in PEP 257. An empty string in double quotes ("") is impossible to confuse with a one...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yapf has a philosophy of not changing the source at all, except for whitespace.
You could always format your code with
black
, then re-format it with yapf. 😉 This would also change some backslashes to parenthesized expressions, I think.PS:
pylint
looks for the most common type of quotes and then complains when the other is used (except for cases like"'"
and'"'
which would otherwise be'\''
or"\""
).Hello!
I would like to communicate that this is also relevant to my interests!
Please implement this!