Skip to content

Conversation

@unvalley
Copy link
Member

@unvalley unvalley commented Jun 1, 2025

Summary

Closes #5979

This PR updates the biome search command to check the file type and pattern language before performing a search.
By default, biome search assumes JavaScript, but it would previously panic if a CSS file was included in the search targets.
With this change, the command no longer panics.

Test Plan

I also tested on the repro: https://github.com/Sjlver/biome-repro-1747046861198

@github-actions github-actions bot added the A-CLI Area: CLI label Jun 1, 2025
@unvalley unvalley marked this pull request as ready for review June 2, 2025 01:48
Copy link
Member

@siketyan siketyan left a comment

Choose a reason for hiding this comment

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

Nice work!

// Default to JavaScript when no language is specified
&GritTargetLanguage::JsTargetLanguage(JsTargetLanguage)
}
_ => return Ok(FileStatus::Ignored), // unreachable
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_ => return Ok(FileStatus::Ignored), // unreachable
_ => unreachable!(),

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer to keep it as is, as otherwise we'd panic again if it turns out we made a mistake (either now or after a refactor).

Copy link
Contributor

@arendjr arendjr left a comment

Choose a reason for hiding this comment

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

Thanks!

// Default to JavaScript when no language is specified
&GritTargetLanguage::JsTargetLanguage(JsTargetLanguage)
}
_ => return Ok(FileStatus::Ignored), // unreachable
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer to keep it as is, as otherwise we'd panic again if it turns out we made a mistake (either now or after a refactor).

@arendjr arendjr merged commit b10cd49 into biomejs:main Jun 2, 2025
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 biome search fails, tries to treat CSS files as JS?

3 participants