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(cli): correctly lint HTML-ish piped from stdin #2686

Merged
merged 12 commits into from
May 4, 2024
Merged

fix(cli): correctly lint HTML-ish piped from stdin #2686

merged 12 commits into from
May 4, 2024

Conversation

tasshi-me
Copy link
Contributor

@tasshi-me tasshi-me commented May 2, 2024

Summary

This PR will fix #2225 and might fix biomejs/biome-intellij#50

With this PR, the format, lint, and check commands with the --stdin-file-path option will correctly output the result for HTML-ish (Astro/Svelte/Vue) files.

Implementation

According to code of lint for file input, when the input is an Astro/Svelte/Vue file, the linted output must be merged with original input.

That process is missing from the code for stdin, so I added it in this PR.

I considered refactoring the process to be common between std_in.rs and process_file.rs, but I did not do it because I am not familiar with this repository's architecture, and the scope of impact would be larger.

Test Plan

I added some new test cases and new snapshots.

  • For each Astro/Svelte/Vue
    • format with --stdin-file-path must finish successfully
    • format --write with --stdin-file-path must finish successfully
    • lint with --stdin-file-path must finish successfully
    • lint --apply with --stdin-file-path must finish successfully
    • lint --apply-unsafe with --stdin-file-path must finish successfully
    • check with --stdin-file-path must finish successfully
    • check --apply with --stdin-file-path must finish successfully
    • check --apply-unsafe with --stdin-file-path must finish successfully

@github-actions github-actions bot added the A-CLI Area: CLI label May 2, 2024
@tasshi-me tasshi-me changed the title fix(biome_cli): correctly lint HTML-ish piped from stdin fix(cli): correctly lint HTML-ish piped from stdin May 2, 2024
@github-actions github-actions bot added the A-Changelog Area: changelog label May 3, 2024
@tasshi-me tasshi-me marked this pull request as ready for review May 3, 2024 11:09
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Thank you!

@ematipico ematipico merged commit e825c55 into biomejs:main May 4, 2024
12 checks passed
@tasshi-me tasshi-me deleted the fix/lint-html-ish-piped-from-stdin branch May 4, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-CLI Area: CLI
Projects
None yet
2 participants