Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tractorcow
Copy link

@tractorcow tractorcow commented Sep 20, 2023

In cases where prettier fails to run (see #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
Copy link
Author

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
Copy link
Author

tractorcow commented Sep 21, 2023

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
Copy link
Author

Unit tests presented :)

@tractorcow tractorcow changed the title fix: prevent empty output.stdout producing invalid path fix: update prettier to respect stderr and stdout concurrently Sep 21, 2023
* @param {string} str - Console output to escape
* @returns {string} - Pure ansi output
*/
function removeANSIColorCodes(str) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had trouble even with -no-colors with unit tests locally. Perhaps some limitation of the command line tool?

Copy link
Contributor

github-actions bot commented Nov 6, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants