Angular-cli: Allow comments in .angular-cli.json

Created on 24 Mar 2017  路  13Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ x ] feature request

Versions.

v1.0.0

Repro steps.

ng s

The log given by the failure.

InvalidConfigError: Parsing .angular-cli.json failed. Please make sure your .angular-cli.json is valid JSON. Error:
SyntaxError: Unexpected token / in JSON at position 533

Desired functionality.

Would be really great to be able to put comments to that file. :)

easy (hours) 3 (nice to have) feature

Most helpful comment

Actually, let's keep this open... I misread it as a bug report, but it's a very reasonable feature request.

All 13 comments

JSON file can not contain comments!

JSON format doesn't allow comments. This is not a limitation with the CLI. It's a limitation of JSON itself.

Closing as the community already answered this, thanks guys!

Actually, let's keep this open... I misread it as a bug report, but it's a very reasonable feature request.

Sorry if you have answered it elsewhere, but can this file actually be a .js file instead of .json?
It will be much more flexible and easier to work with.

@bekos no, that is not supported.

@filipesilva This would help if we actually needed a bit different setup for production and development setups in angular-cli. Does this make sense for a new feature request?

@bekos I'm curious on the particulars of your scenario. Can you open a new issue to discuss your request?

Would be nice to use https://www.npmjs.com/package/strip-json-comments

const json = '{/*rainbows*/"unicorn":"cake"}';

JSON.parse(stripJsonComments(json));
//=> {unicorn: 'cake'} 

I think strip-json-comments this is a very good solution. @filipesilva what do you think?

I think this is a great feature and the tsconfig.json also allows comments, https://github.com/Microsoft/TypeScript/issues/4987.

The config files need comments for clarification and future reading.

Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings