feat(organizeImports): add :STYLE: group matcher#10070
Conversation
🦋 Changeset detectedLatest commit: 2bf8fce The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughAdds a Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/biome_js_analyze/src/assist/source/organize_imports.rs (1)
333-336:⚠️ Potential issue | 🟡 MinorDoc text is stale: it says “two exceptions” but the example uses one.
After switching to
!:STYLE:, this line should reference a single exception so readers don’t second-guess the config.✏️ Suggested wording tweak
- /// `**` matches everything and is followed by the two exceptions that exclude style imports. + /// `**` matches everything and is followed by an exception that excludes style imports.Also applies to: 341-343
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_js_analyze/src/assist/source/organize_imports.rs` around lines 333 - 336, The documentation comment describing the import grouping is inaccurate: it says “two exceptions” but the example uses a single exception after switching to `!:STYLE:`; update the doc text to reference a single exception (e.g., change “two exceptions that exclude style imports” to “an exception that excludes style imports”), and make the same wording change in the other occurrence that parallels this text (the comment block that mentions `**` and `!:STYLE:` further down). Ensure the phrasing clearly matches the example using `**` followed by the single `!:STYLE:` exception.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crates/biome_rule_options/src/organize_imports/import_groups.rs`:
- Line 1: The Unix-only import OsStrExt causes Windows builds to fail because
calls using .as_bytes() rely on that trait; remove the use
std::os::unix::ffi::OsStrExt import and replace platform-specific .as_bytes()
usages with a portable conversion such as calling
std::ffi::OsStr::to_string_lossy() and then taking .as_bytes() on the resulting
Cow<str> (or otherwise convert the OsStr to a UTF-8/byte representation in a
cross-platform way) wherever .as_bytes() is used in import_groups.rs so the code
compiles on non-Unix targets; update references to OsStrExt and as_bytes()
accordingly.
---
Outside diff comments:
In `@crates/biome_js_analyze/src/assist/source/organize_imports.rs`:
- Around line 333-336: The documentation comment describing the import grouping
is inaccurate: it says “two exceptions” but the example uses a single exception
after switching to `!:STYLE:`; update the doc text to reference a single
exception (e.g., change “two exceptions that exclude style imports” to “an
exception that excludes style imports”), and make the same wording change in the
other occurrence that parallels this text (the comment block that mentions `**`
and `!:STYLE:` further down). Ensure the phrasing clearly matches the example
using `**` followed by the single `!:STYLE:` exception.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1ad3a156-601f-4000-a08d-21b54044265b
⛔ Files ignored due to path filters (1)
crates/biome_js_analyze/tests/specs/source/organizeImports/style-grouping.js.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (5)
.changeset/dry-crews-shake.mdcrates/biome_js_analyze/src/assist/source/organize_imports.rscrates/biome_js_analyze/tests/specs/source/organizeImports/style-grouping.jscrates/biome_js_analyze/tests/specs/source/organizeImports/style-grouping.options.jsoncrates/biome_rule_options/src/organize_imports/import_groups.rs
93da04e to
e749991
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
e749991 to
80c0460
Compare
Summary
This is a small feature that should improve the life of users that want to group style imports together.
This PR adds a
:STYLE:group matcher that matches style imports such asstyle.cssorstyle.scss.The list of supported extensions is taken from perfectionist.
Test Plan
I added a test
Docs
I updated the assist action documentation and added a changeset.