Support JSON6 (#10456)

* Add test

* Support JSON6

* Test

* Print `null` instead of holes

* More tests

* Update changelog

* Style

* Minor refactor

* Fix AST clean

* Fix `Identifier` clean

* Fix AST compare

* Style

* Reword changelog

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
This commit is contained in:
fisker CheungandGeorgii Dolzhykov authored and GitHub committed 2021-03-04 19:37:42 +02:00
1 parent 37aa31e929
commit 8a1ee9ad1b
7 files changed
+772 -232

No files matched your search

+2 -2
View File
@@ -1,6 +1,6 @@
#### Stricter JSON parser (#10346, #10443 by @fisker)
#### Stricter JSON parser (#10346, #10443, #10456 by @fisker)
Previously we allow all kinds of JavaScript expressions in `json` and `json5` parser, now they are stricter.
Prettier internally uses a JavaScript expression parser to parse JSON. That's why the `json` and `json5` parsers used to be very forgiving and allowed all kinds of JavaScript expressions. Now they are much stricter, although some simple non-standard syntax is still allowed (e.g., [JSON6](https://github.com/d3x0r/JSON6) is supported, except for multiple minus signs: `----123`).
<!-- prettier-ignore -->
```js