Rework how we extract lint failures into GitHub annotations #1961
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix presentation of lint failures as GitHub annotations, originally introduced in #725 and broken (I think) in #1197.
For background, GitHub's annotation extraction requires that file paths be absolute and reflect the working directory that the repository is checked out into. That doesn't work great for us because we do our builds inside of a Docker container under a different path. So we need to rewrite file paths in the outputs that we get from running lint inside Docker. We do that using a Docker argument (i.e. environment variable) that gets passed in. Previously, we needed to escape our use of that variable in the lint script so that Docker itself wouldn't apply variable substitution that we didn't want, but with new style heredocs, Docker wasn't applying those substitutions anymore. We didn't notice at the time because, well, we didn't have any lint failures.
Separately from all of that, we've only historically supported extracting annotations for eslint failures and not failures for our other lint steps.
tsc
andstylelint
don't support custom output formatters, as far as I can tell, but GitHub does support extracting annotations using regexes ("problem matchers") instead of requiring custom output formatting from the tools themselves. For consistency, switcheslint
to use a problem matcher as well, rather than having a mix of approaches.Here's what a PR looks like with failures now:
My biggest complaint with this is that there's no way to tell which tool threw a particular error, but as far as I can tell there's no way to add that information.