Skip to content

Adding Comments in JSON file format #34066

Description

@RishiSharma62004

Command

config

Description

Currently, Angular CLI configuration files that use the JSON format do not support comments. This makes it difficult for developers to document configuration values, explain the purpose of specific settings, or provide additional context directly within the configuration file.
Configuration files often contain values such as URLs, environment-specific settings, build options, asset paths, proxy configurations, or other properties whose purpose may not be immediately obvious to other developers working on the project.

Describe the solution you'd like

Consider supporting comments in Angular CLI JSON configuration files, either by:

Supporting a JSON-based format that allows comments, such as JSONC.
Supporting a compatible configuration syntax that permits // and/or /* */ comments.
Or providing another officially supported mechanism for documenting configuration values directly within the configuration file.
For example:

{
"projects": {
"my-app": {
"architect": {
"build": {
"options": {
// Required when the application is deployed under a sub-path.
"baseHref": "/my-application/"
}
}
}
}
}
}

Expected Benefits
Supporting comments would make Angular CLI configuration files:

Easier to understand for new and existing developers.
More self-documenting.
Easier to maintain and review.
Better suited for documenting non-obvious configuration decisions.
Less dependent on external documentation for configuration-specific context.
Backward Compatibility
Existing valid JSON configuration files should continue to work without modification. Comment support should be an additive enhancement and should not change the behavior of existing configuration properties.

Additional Context
This feature would be particularly useful for large projects and teams where configuration values may have historical, environment-specific, or deployment-related reasons that are not obvious from the value itself.

Describe alternatives you've considered

No response

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions