quote-type: single should (maybe?) allow double-quoted strings with escape sequences
scolby33 opened this issue · 1 comments
scolby33 commented
I use the below configuration, but came across the need to encode a string that contained a newline character, like so foo: "needs a newline\n"
. It's possible I'm missing something obvious, but should quote-type: single
allow double-quoted strings that contain escapes? I realize that could mess people up in some cases, so maybe a new option should be added? If not, my solution for the moment is adding # yamllint disable-line rule:quoted-strings
in the few places it turns out I need a newline.
quoted-strings:
quote-type: 'single'
required: true
adrienverge commented
Hello Scott,
That's an interesting question.
I'm not sure what's best, but it's always possible to avoid double-quotes if one wants.
Here are 4 examples of writing the exact same value (needs a newline\n
):
"needs a newline\n"
'needs a newline
'
>
needs a newline
|
needs a newline