Joseph Frazier
|
a42db30946
|
Add JSON support (#2173)
* Add JSON support
This fixes https://github.com/prettier/prettier/issues/1973 by using
[json-to-ast] to parse JSON, then converting the AST into a
mostly-Babylon AST, so as to piggyback on the existing printer logic.
Identifiers and literals are currently printed verbatim from the input,
but this could be improved upon later (at least for literals, not sure
about identifiers).
[json-to-ast]: https://github.com/vtrushin/json-to-ast
* Rename `json-to-ast` parser to `json`
See https://github.com/prettier/prettier/pull/2173#discussion_r122574644
* json: Use createError to have a pretty error
See https://github.com/prettier/prettier/pull/2173#discussion_r122574748
* json: Transform AST without mutations
See https://github.com/prettier/prettier/pull/2173#discussion_r122574690
|
2017-06-17 10:36:42 -10:00 |