This task is related to #1573 , but it has slightly different requirements and use cases, although we could potentially solve both with the same solution.
Monorepo (package manager workspaces) are very common in the web ecosystem, and they come in different flavours and expectations.
However, the common denominator is the following: a root configuration file, and each package in the monorepo extends the root configuration.
Flavours:
pnpm run --filter
, turborepo
, etc. This is very common for building tools such as bundlers, compilers, and doc generation.Biome is a particular case here, because, even though it is a linter/formatter, in the future Biome will also transform/compile users's code, so it requires awareness of the manifest file and the dependency graph. Which means, while it makes sense to run biome check
at the root of the monorepo, what about a - future - biome compile
command?
We will have to untangle this. I am also happy to force users to set up Biome in one way in their monorepo.
Workspace
The solution should lie in the Workspace. The Workspace
is what LSP and CLI both share, meaning that both of them hold an instance of it, and they use it to pull data when they need.
The CLI usually works from up to bottom, it scans and handles the files that are closest to the working directorey, and eventually handles the farthest files from the working directory. Although, this isn't always true, because for each directory AND file, we always span a thread, which means that eventually all jobs go their own way.
We would need to change the strategy of our CLI here, in way where we would need to read and resolve possible biome.json
files in each folder.
This could be potentially solved with a new workspace
configuration, that would allow Biome to resolve the packages before hand.
The LSP has a different problem to solve. Biome must apply the correct configuration for the opened file when jumping from one file to another.
Workspace
The reason why I think the solution lies in the Workspace
, is because both CLI and LSP have to do a very similar job: when handling a file, we should apply the configuration that belongs to that file. The Biome Workspace
would potentially store all those configurations, and then the CLI and LSP could:
Workspace
to use the correct configuration, e.g. Workspace::swap_config
Workpace
could that by checking the path of the file/folder, and resolving automatically the configuration to usePay 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