wearerequired / lint-action

✨ GitHub Action for detecting and auto-fixing lint errors
MIT License
567 stars 136 forks source link

fix: update prettier to respect stderr and stdout concurrently #722

Open tractorcow opened 1 year ago

tractorcow commented 1 year ago

In cases where prettier fails to run (see https://github.com/wearerequired/lint-action/issues/718) output.stdout can be empty. Generating an annotation with a blank path causes a 422 validation error pushing this check to github.

I have updated the logic to check both stdout and stderr, applying appropriate checks and reporting where available.

tractorcow commented 1 year ago

For context this is the kind of output.stderr that can be encountered during linting.

[error] src/components/Icon/Icon.stories.tsx: SyntaxError: ',' expected. (32:3)
[error]   30 |     },
[error]   31 |   },
[error] > 32 | } satisfies Meta<typeof Icon>
[error]      |   ^
[error]   33 |
[error]   34 | export default meta
[error]   35 | type Story = StoryObj<typeof Icon>

If I were to parse this instead of output.stdout

tractorcow commented 1 year ago

Pushed a check to stderr. Below is an example of the check running against my own (failing) codebase. Previously this error would cause a 422 pushing the check to github, and give a false negative (green tick when it should be an error).

image

tractorcow commented 1 year ago

Unit tests presented :)

github-actions[bot] commented 11 months ago

Thank you for your contribution to this project!

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.