amzn / style-dictionary

A build system for creating cross-platform styles.
https://styledictionary.com
Apache License 2.0
3.93k stars 557 forks source link

fix: escape double quotes for ts outputStringLiterals #1020

Closed andnorda closed 9 months ago

andnorda commented 1 year ago

Escaping double quotes when generating string literal types is useful when a token value is referencing a font family name.

jorenbroekema commented 9 months ago

Hi, would you be down to create this change on the v4 branch? the v3/main branch is so far behind at this point that I'm only backporting really important bug or security fixes.

Could you also explain a bit more in detail why there's a triple backslash instead of a double? Double is what I'd expect, one to escape the escape character and one for the escape character itself, but the third one isn't immediately obvious to me why it's required or why that's the output of the test.

andnorda commented 9 months ago

Opened a new PR to v4 here: https://github.com/amzn/style-dictionary/pull/1097

Not sure what the triple backslash was about. It seems to work with double backslashes in the other PR.

andnorda commented 9 months ago

As this rule says, some backslashes have no effect: https://eslint.org/docs/latest/rules/no-useless-escape

I think that was the case here, so functionally three was the same as two.