ataylorme / eslint-annotate-action

A GitHub action that takes ESLint results from a JSON file and adds them as annotated pull request comments
MIT License
93 stars 33 forks source link

Check for empty report file #52

Closed heewa closed 1 year ago

heewa commented 1 year ago

In the case that a reportFile does exist, but is empty, JSON.parse() returns null, which ends up throwing a confusing error message later on src/getPullRequestChangedAnalyzedReport.ts#L20 about filter not existing on a null object.

This change improves the error message by checking and throwing a clear error message at an earlier point of failure.

Note: I'm not sure if I updated the build files correctly. I ran npm run build, but dist/index.js has a ton of changes, which don't look related to my change. Let me know if I need to do something differently.

heewa commented 1 year ago

Alternatively, should an empty report just be a no-op/pass?

ataylorme commented 1 year ago

@heewa thank you for the PR. I took this and added a unit test in #58, giving you credit.