microsoft/node-jsonc-parser

Upgrading from 2.1.1 to 2.2.0 has diagnostic for file with only comments

dsherret opened this issue · 3 comments

The following jsonc file returns a diagnostic in 2.2.0:

/// test
//////asdf

Diagnostic:

ValueExpected:  (20)

I know this is a rare scenario, but I believe this is a valid jsonc file and a diagnostic should not be created.

Additionally, in this scenario the return value of parser.parseTree is undefined yet the return value is not defined as possibly returning that value.

Use ParseOption.allowEmptyContent to allow such inputs again.

@aeschli thanks! I'll update my code to use that. By the way, I think the changelog should be corrected for 2.2—it says allowTrailingComma was added instead of allowEmptyContent. Also, this is a breaking change so it probably should have been a major version increase, but that's not a big deal as this is a pretty rare scenario.

As always, thanks for the library!

You are right, should have been a major version change.
Updated the CHANGELOG.