Cannot apply prettier because of `\`
Soreine opened this issue · comments
Sometimes, text containing '' are making prettier
fail:
1) slate-hyperprint text-escaping:
SyntaxError: Unterminated string constant (13:32)
11 | </paragraph>
12 | <paragraph>
> 13 | {'Should escape \\''}
| ^
14 | </paragraph>
15 | <paragraph>
16 | {' '}
at createError$1 (node_modules/prettier/parser-babylon.js:1:50)
at parse (node_modules/prettier/parser-babylon.js:1:721)
at Object.parse (node_modules/prettier/index.js:3763:12)
at formatWithCursor (node_modules/prettier/index.js:21470:22)
at format (node_modules/prettier/index.js:21510:10)
at Object.format (node_modules/prettier/index.js:21735:12)
at hyperprint (src/index.js:36:32)
at Context.<anonymous> (tests/all.js:24:28)
SyntaxError: Expecting Unicode escape sequence \uXXXX (2:27)
1 | <document>
> 2 | <x-embed data="{\"url\":\"https://some-url.com\",\"type\":\"some-type\",\"embed\":{\"type\":\"some-type\",\"url\":\"https://some-url.com\",\"html\":\"<div>some html</div>\"}}" />
| ^
3 | </document>
Here is another example that can't be prettied.