Use Biome in big projects
Biome can provide some tools that can help you to use it properly in big projects, such as monorepo or workspaces that contain multiple projects.
Use multiple configuration filesSection titled Use multiple configuration files
When you use Biome’s features - either with the CLI or LSP - the tool looks for the nearest configuration file using the current working directory.
If Biome doesn’t find the configuration file there, it starts walking upwards the directories of the file system, until it finds one.
You can leverage this feature to apply different settings based on the project/folder.
Let’s suppose we have a project that contains a backend app and new frontend app.
This means that when you run a script from the file
app/backend/package.json, Biome will use the configuration file
When you run a script from
app/frontend/new-app/package.json, Biome will use the configuration file
Share the configurationSection titled Share the configuration
It’s possible to use the
extends configuration option to breakdown options across files.
Let’s assume that we have these requirements:
legacy-apphave to format using spaces;
new-apphave to format using tabs;
- all apps have to format using line width 120;
backendapp needs some extra linting;
We start by creating a new configuration file at
app/biome.json, and put there the shared options:
Now let’s move
app/frontend/legacy-app/, because that’s where we need to use a different formatting.
Then, we tell Biome to inherit all the options from the main
app/biome.json file, using the
Let’s jump to
app/backend/biome.json, where we need to enable the linting: