New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow trailing commas in array #6

Merged
merged 2 commits into from Mar 5, 2018

Conversation

Projects
None yet
2 participants
@sqs
Copy link
Contributor

sqs commented Mar 3, 2018

Previously, allowTrailingCommas only allowed trailing commas in objects, and it would still return errors for JSON like [1, 2, ]. This was surprising to me as a user. Is there a reason for allowing trailing commas in objects but not arrays?

Also fixes the assertValidParse helper. It was not failing even when there were parse errors (because it only failed if there were parse errors AND the first parse error's code was "undefined"; I couldn't find a case where that would be true).

sqs added some commits Mar 3, 2018

allow trailing commas in array when allowTrailingCommas option is true
Previously, allowTrailingCommas only allowed trailing commas in objects.
fix assertValidParse: fail if there are errors
Previously, it only failed the test if an error's code was "undefined".

@aeschli aeschli merged commit 5f475b5 into Microsoft:master Mar 5, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla All CLA requirements met.
Details
@aeschli

This comment has been minimized.

Copy link
Contributor

aeschli commented Mar 5, 2018

Makes sense, thanks @sqs !

@sqs

This comment has been minimized.

Copy link
Contributor

sqs commented Mar 5, 2018

Thanks for the quick merge! BTW we are shipping this in Sourcegraph Server for users and admins to edit config. It works great.

@aeschli aeschli added this to the March 2018 milestone Mar 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment