prettier/tests/quotes
Christopher Chedeau c9af5a6c3b Escape strings using jsesc (#229)
The current implementation with `JSON.stringify()` is clever but unfortunately generates incorrect JavaScript. Using `jsesc` seems like a better and safer option. https://github.com/mathiasbynens/jsesc It doesn't have any dependencies and is pretty small.

I opted for escaping all the non ascii characters, so we don't display emojis anymore. I don't think that the world is ready yet for having random unicode characters inside of source files, there still are so many parts of the toolchain that breaks with them. If we want to revert back on this decision, there's a `minimal` option on jsesc which only escapes values that need to in order to generate valid JavaScript file (assuming the encoding of the file is set to utf8).

Also, while working on React Native, we've seen that there is an optimization inside of jsc for js files that are all ascii: it doesn't do a copy for the conversion to ucs16.

Fixes #163
2017-01-16 11:03:59 -05:00
..
__snapshots__ Escape strings using jsesc (#229) 2017-01-16 11:03:59 -05:00
functions.js Add tests for quotes option 2017-01-13 13:25:13 -05:00
jsfmt.spec.js Add tests for quotes option 2017-01-13 13:25:13 -05:00
strings.js Add tests for quotes option 2017-01-13 13:25:13 -05:00