Skip to content
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 tsconfig.json files with comments #9

Closed
rob3c opened this issue Mar 7, 2016 · 3 comments
Closed

Allow tsconfig.json files with comments #9

rob3c opened this issue Mar 7, 2016 · 3 comments

Comments

@rob3c
Copy link

rob3c commented Mar 7, 2016

Hi, according to TypeScript #4987, it looks like comments are allowed in tsconfig.json files now. Unfortunately, tsconfig-glob throws an error if it has any, though.

I think this would be an easy fix if you're willing to take on an additional dependency like strip-json-comments to take them out first. I see you're already stripping possible BOMs, so this would just be another filter before JSON.parse. I'm happy to put together a pull request using it if you're willing to accept one.

Cheers,
Robert

@wjohnsto
Copy link
Owner

wjohnsto commented Mar 8, 2016

I haven't worked with strip-json-comments but it seems fairly straightforward. If you want to create a pull request I will look over/accept it. Otherwise I will get to this when I have some time.

@wjohnsto
Copy link
Owner

I'm not sure there is a way to overwrite the tsconfig.json and preserve the json comments without coming up with some extravagant parsing method. TypeScript can afford to allow comments since they are only reading the tsconfig.json. Unfortunately we have to write to the file as well, so you would lose your comments.

@rob3c
Copy link
Author

rob3c commented Mar 15, 2016

Oops - you're riight! I was only thinking about the reading part and forgot about the rewriting aspect lol. Since it's more than a simple fix, please don't worry about it on my account. Thanks, anyway!

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

No branches or pull requests

2 participants