-
-
Notifications
You must be signed in to change notification settings - Fork 475
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
🐛 Ignore pattern in linter
feature wrongly applies to formatter
#2131
Comments
And I suspect this issue and #2080 have the same root cause, which may be related to how we are matching paths for including and ignoring files. |
Some debugging: The biome/crates/biome_cli/src/execute/traverse.rs Lines 694 to 712 in 8dc5011
As we can see it will first check if the directory is ignored by the feature ( biome/crates/biome_cli/src/execute/traverse.rs Lines 703 to 706 in 8dc5011
In which biome/crates/biome_cli/src/execute/mod.rs Lines 31 to 36 in 8dc5011
So The reason why ignore patterns like Unfortunately, I don't have a good idea to fix this issue. This might be due to the limitation of the matching function. |
It looks like this behavior (ignoring directories) is introduced in rome/tools#4276. @ematipico Do you have any suggestions? |
@Sec-ant do you experience the same issue with the LSP? |
Sorry but I'm not very certain how to test LSP? I use Biome via the extension in VSCode, but that will only execute |
If I am not wrong, I could try to change the code like following: impl Execution {
pub(crate) fn as_feature_name(&self) -> Option<FeatureName> {
match self.traversal_mode {
TraversalMode::Format { .. } => Some(FeatureName::Format),
TraversalMode::Lint { .. } => Some(FeatureName::Lint),
_ => None,
}
}
} This will require some change to allow querying the server without a feature. |
Yes, I did exactly this, but |
Thank you, @Sec-ant, for your findings! Those are very useful and will save a ton of time |
I am looking at the issue, I should be able to fix it |
Looking better at the use case, I believe it's expected, although I also think the users' expectations are misinterpreted. The glob Now, there's definitely an issue on how we mark folders as ignored, but the outcome of changing the globs is actually expected. Maybe we should write a better guide on how EDIT: The issue becomes more subtle because The correct fix is to use |
We could add a lint rule that could suggest users avoid globs that would look like |
I agree. Many
This may be difficult to achieve because we don't know if the user wants to ignore a file or a folder. |
Environment information
What happened?
Clone the repro repo:
cd
into the repo folderFile structure:
Biome configuration
biome.json
:a.js
in thebuild
folder:Run the following command
npm i npx biome check .
The output doesn't report any formatting suggestions. But we didn't ignore any files in the formatter, so it should report a formatting suggestion for
build/a.js
.If we change the ignore pattern from
["**/build"]
to["**/build/*"]
or["**/build/**"]
, the formatting suggestion will be printed as expected.Also, Biome doesn't seem to support trailing slashes in the pattern.
**/build/
will not match thebuild
dir. But I think this may be considered as another issue.Expected result
Ignore patterns in
linter
feature shouldn't apply toformatter
or other features.Code of Conduct
The text was updated successfully, but these errors were encountered: