-
-
Notifications
You must be signed in to change notification settings - Fork 485
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(glob): correctly handle relative patterns #2620
base: main
Are you sure you want to change the base?
Conversation
The issue is more complex that I though. Let's assume that our project is in a folder biome lint ./
biome lint /temp/ Unfortunately this is not the case, because Biome doesn't normalize the paths and pass them as is. Giving the following biome config: {
"overrides": [
{
"include": ["./file.js"],
"linter": {
"enabled": false
}
}
]
} The first command Ideally we should normalize all path to absolute path and turn relative glob patterns into absolute glob patterns. Or we should remove the working directory of an absolute path. Not sure how symlinks play there. Otherwise, we could assume that users always pass relative paths on the CLI. Anyway, I think we should take some time to think about that and delay the fix to a minor or major version. |
I think this is the right direction to go. But I don't think we need to implement everything ourselves. I did some search the other day for rust crates that handle glob patterns: The That's when I find another crate While surfing the issues of Anyway, I'm sharing these only to hope they can be helpful when tackling the glob matching issue. :) |
Few months ago I tried to use globset and that broke a lot of user's code. We had to revert that. It misses an important functionality that vendored glob has. |
Oh, I see. That may explain why ruff has both glob and globset as dependencies. Do you still remember what's the important functionality it misses? |
We could try to switch to a different glob library for Biome 2.0 or later. I would like to work on that in the future. |
Absolutely, just share some findings! |
Summary
Fix #2421
Biome relies on an internal fork of the glob crate.
This crate converts relative glob patterns into recursive glob patterns.
This means that
./file' is equivalent to
./**/file'.This is surprising behavior and has been reported as a bug by our users.
Biome no longer converts relative glob patterns to recursive glob patterns.
EDIT: see the next comment.
Test Plan
I updated the unit tests of the glob pattern utility.