Prior to #1687 and #1995, Biome traversed all directories regardless of include
and ignore
.
Glob patterns of include
and ignore
were only tested on regular files.
Users were not able to prevent Biome from traversing a directory. This resulted in a performance penalty (when a large hierarchy was traversed for nothing) and reporting errors (broken symlinks and files with higher permissions).
#1687 fixed this by skipping folders that match at least one ignore
pattern and folders that don't match all include
patterns.
Unfortunately, this introduced a regression because it is likely that a folder don't match any include
pattern.
Let's take an example:
β― tree
.
βββ biome.json
βββ src
βΒ Β βββ file.js
β― cat biome.json
{
"files": {
"include": ["./**/*.js"]
}
}
β― biome format src
internalError/io βββββββββββββββββββββββββββββββββ
β No files were processed in the specified paths.
Here src/file.js
is not processed because src
doesn't match ./**/*.js
.
This is an unexpected result.
To avoid this issue, #1995 doesn't match folders (including symlinks that target a folder) against include
.
This fixed the regression. However, this partially reverts #1687 by not ignoring the folders in which all its files don't match all patterns of include
.
For instance, the following configuration should prevent Biome from traversing the test
folder.
β― tree
.
βββ biome.json
βββ src
βΒ Β βββ file.js
βββ test
βΒ Β βββ ...
β― cat biome.json
{
"files": {
"include": ["./src/**/*.js"]
}
}
To prevent Biome from visiting test
, we should adopt a dedicated strategy for matching directories within include
:
If a folder is not a prefix of at least one pattern of include
, it should be ignored.
Here test/
is not a prefix of ./src/**/*.js
. test/
is a valid prefix of ./**/*.js
or ./test/**/*.js
.
See #1995 for more context.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too