feat: have --print-config output valid JSON data #3819
Description
Expected Behavior
If I run commitlint --print-config --color=false
I would like to be able to read a valid JSON that I can parse for example with jq
. I would like to go this path, because this way it fully resolves extends
settings etc. So I get the complete configuration.
Current Behavior
The output is not valid JSON as keys are not wrapped with quotation marks and single quotation marks are used for values. I tried to use sed
substitution to solve the issue, but this is very complex and there any many edge-cases like quotation mark escaping in string values etc.
Affected packages
- cli
- core
- prompt
- config-angular
Possible Solution
Print out valid JSON like JSON.stringify content to stdout.
Context
I need to access commitlint configuration parameter including presets in a bash script without node.