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

Lint SVG from stdin #82

Merged
merged 2 commits into from
Jun 8, 2023
Merged

Lint SVG from stdin #82

merged 2 commits into from
Jun 8, 2023

Conversation

ericcornelissen
Copy link
Contributor

@ericcornelissen ericcornelissen commented Jun 8, 2023

Closes #81 - /cc @PaulRBerg


Extend the CLI to support providing an SVG on stdin. The CLI will only do this when provided with the --stdin flag, I choose this design as it was the only reliable way of switching between files and stdin I could find.

The stdin flow is based on the Readable docs and just calls the JS API's lintSource function on the entire input.

Extend the CLI to support providing an SVG on `stdin` [1]. The CLI will
only do this when provided with the `--stdin` flag, I choose this design
as it was the only reliable way of switching between files and stdin I
could find.

Despite the awkward diff, the CLI flow for files (i.e. if `--stdin` is
not used) is unchanged. The stdin flow is based on [2] and just calls
the JS API's `lintSource` function on the entire input.

--
1. https://nodejs.org/api/process.html#processstdin
2. https://nodejs.org/api/stream.html#readablereadsize
@ericcornelissen ericcornelissen marked this pull request as ready for review June 8, 2023 08:16
@PaulRBerg
Copy link

This is awesome, TY very much.

@ericcornelissen ericcornelissen merged commit 965f9b7 into master Jun 8, 2023
@ericcornelissen ericcornelissen deleted the 81-cli-lint-from-stdin branch June 8, 2023 19:59
@github-actions
Copy link

github-actions bot commented Jun 8, 2023

🎉 This PR is included in version 2.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

Support SVGs directly from the CLI
2 participants