Open rhuanbarreto opened 11 months ago
Essentially a duplicate of #46340 / #31566, just a different format.
As more and more people start reporting the same thing with different formats, it would be interesting to revisit if it's worth to implement a high level interface for outputting command results without having to use low-level code with the internals of typescript.
As some comments in other threads mentioned, people even started regex'ing the output to produce a XML output.
So let me change the proposal. What if the proposal would be "Offer machine readable output from tsc
"? Would that still be a duplicate and be disregarded @MartinJohns?
I think the specific suggestion of SARIF (honestly the first I've heard of this) as a standard format, as opposed to just "json" / "xml", makes this a lot more actionable than previous suggestions.
That said, there are still a ton of "policy" decisions that make this a breeding ground for bikeshedding, particularly over how configuration errors vs analysis errors would be surfaced here.
The SARIF output in MSVC and other Microsoft compilers would be a good reference for those policy decisions. For example, SARIF doesn't have specific support for nested diagnostics so they have to be represented in property bags. MSVC's structure is described here https://learn.microsoft.com/en-us/cpp/build/reference/sarif-output?view=msvc-170#sarif-result-data
Proof of concept here: (https://github.com/typeholes/TypeScript/tree/safir) Please note:
π Search Terms
sarif
β Viability Checklist
β Suggestion
Today the
@typescript-eslint/eslint-plugin
plugin will not output errors that happen during compile time. This is by design.So in my CI (Github Actions) I use eslint but I also need to run a
tsc --noEmit
in order to check compile-time errors.Ok so far. The pipeline will fail and PR merge will be prevented.
Let's make the developer experience better. Today, in case of a failure in
tsc --noEmit
, the developer will need to read the step logs to see the failures of the command.ESlint already supports the
@microsoft/eslint-formatter-sarif
to output SARIF format outputs in case of failures and github can take those failures and beautifully display them in the PR for the developer. Link to the Github feature. I already use that for eslint and the typescript plugin.My feature request is for
tsc
CLI to have same functionality and output SARIF format files in the output if requested. This can be a flag or implement an interface where output formatters can be implemented separately like ESlint.π Motivating Example
This feature improves the developer experience around the git workflow in Github and in any other version control system.
π» Use Cases
Showed in the suggestion