Replies: 1 comment 3 replies
-
|
Good question. If we allow it and change the return shape accordingly, this will be a very disruptive breaking change. IMO the benefit is very marginal to justify the change: both empty string and comment only input is not the typical expected input for The JSONC parsing is an interesting use case, I think the current prettier approach is good enough since such input is not the popular JSONC input either. Would it help prettier if we throw a new error for comment-only / empty string in |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Prettier uses
parseExpressionto parse JSON files, few month ago, user request to allow comment only JSONC file, sincejsonc-parserwon't throw, so we accepted, prettier/prettier#17269 .Does it make sense to allow
parseExpression(''),parseExpression('/* comment only */')?If we allow this, what the result should be? Since there is no
EmptyExpressionin ESTree.is reasonable, but it will be a breaking change.
Beta Was this translation helpful? Give feedback.
All reactions