Closed
Description
🚀 Feature request
- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [x ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Description
ng lint --format=json > issues.json
Worked previously as describe here: #4959
Worked for outputting results to json or any format.
In Angular 7 there was the addition of color to the output of lint results. This has broken the above workaround for outputting to a file.
what was previously like:
[
{
"endPosition": {
"character": 144,
"line": 8,
"position": 361
},
"failure": "Exceeds maximum line length of 140",
"name": "C:/myProject/src/app/modeling.component.ts",
"ruleName": "max-line-length",
"ruleSeverity": "ERROR",
"startPosition": {
"character": 0,
"line": 8,
"position": 217
}
}
]
is now like so
�[37m[
{
"endPosition": {
"character": 144,
"line": 8,
"position": 361
},
"failure": "Exceeds maximum line length of 140",
"name": "C:/myProject/src/spp/modeling.component.ts",
"ruleName": "max-line-length",
"ruleSeverity": "ERROR",
"startPosition": {
"character": 0,
"line": 8,
"position": 217
}
}
]�[39m
Solution I would like
I would like an option added to ng lint to output to a file easilyWorkaround
"ng lint --format=json | sed -r \"s/\\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g\" > issues.json"
Which is ugly but works