Troubleshooting
Цей контент ще не доступний вашою мовою.
Biome is designed to be fast and to work without much setup. When it does not, the cause is usually a folder it should not be looking at, or a rule that needs more work than the others.
Biome is slow
Section titled “Biome is slow”Most slowdowns come from Biome processing more files than it needs to, or from rules that analyze your whole project. Try the following steps in order, and check whether things improve after each one.
Ignore build output
Section titled “Ignore build output”Folders such as dist/ or build/ often contain large, minified files that you do not need to check. Exclude them with a force-ignore pattern, which starts with !!, in files.includes:
{ "files": { "includes": ["**", "!!**/dist", "!!**/build"] }}Unlike a regular ! pattern, a !! pattern also stops Biome from indexing these files in the background.
Check for project rules
Section titled “Check for project rules”Some rules need information about your whole project, for example to detect import cycles, unresolved imports, or unhandled promises. When you enable one of them, Biome first scans your project and its dependencies, which can make it several times slower on large codebases.
These rules belong to the project and types domains. Try disabling those domains to see if they are the cause:
{ "linter": { "domains": { "project": "none", "types": "none" } }}If this helps, but you want to keep the rules, the slowdown probably comes from scanning your dependencies. As a test, force-ignore node_modules with "!!**/node_modules" in files.includes.
Type information from your dependencies is then no longer available, so ignore only the dependency that causes the problem. The next sections help you find it.
Profile type inference
Section titled “Profile type inference”If the slowdown comes from the types domain, pass --profile-type-inference to lint or check to see how long Biome spends on type inference. This flag is available since Biome v2.6.
npx biome lint --profile-type-inferencepnpm biome lint --profile-type-inferencebunx biome lint --profile-type-inferencedeno run -A npm:@biomejs/biome lint --profile-type-inferenceyarn biome lint --profile-type-inferencebiome lint --profile-type-inferenceThe report groups the results by file and lists only the most expensive operations in each one. To see every operation, also pass --verbose. The output is long, so profile one file at a time:
npx biome lint --profile-type-inference --verbose src/slow-file.tspnpm biome lint --profile-type-inference --verbose src/slow-file.tsbunx biome lint --profile-type-inference --verbose src/slow-file.tsdeno run -A npm:@biomejs/biome lint --profile-type-inference --verbose src/slow-file.tsyarn biome lint --profile-type-inference --verbose src/slow-file.tsbiome lint --profile-type-inference --verbose src/slow-file.tsFind the slow files
Section titled “Find the slow files”If the steps above did not help, record a trace to see which files take the longest. Run any command with the following flags:
npx biome lint --log-level=tracing --log-kind=json --log-file=tracing.jsonpnpm biome lint --log-level=tracing --log-kind=json --log-file=tracing.jsonbunx biome lint --log-level=tracing --log-kind=json --log-file=tracing.jsondeno run -A npm:@biomejs/biome lint --log-level=tracing --log-kind=json --log-file=tracing.jsonyarn biome lint --log-level=tracing --log-kind=json --log-file=tracing.jsonbiome lint --log-level=tracing --log-kind=json --log-file=tracing.jsonThis writes timing information for every step to tracing.json. The file can be large, so use a tool such as jq to filter it. For example, to list how long Biome spent analyzing each file:
jq 'select(.span.name == "pull_diagnostics") | { path: .span.path, time_busy: .["time.busy"] }' tracing.json > slowest.jsonReplace pull_diagnostics with another step to investigate it:
| Step | What it measures |
|---|---|
pull_diagnostics |
Linting and analyzing a file. |
format_file |
Formatting a file. |
open_file_internal |
Opening and parsing a file. Its reason field tells you why the file was opened. |
update_module_graph_internal |
Indexing a file for project rules. |
Once you know which files are slow, exclude them, or report the problem so that the Biome team can look into it.
Biome uses a lot of memory
Section titled “Biome uses a lot of memory”If your editor’s Biome process uses a lot of memory, you probably have a rule from the project or types domain enabled.
To understand your types, Biome reads the type definitions (.d.ts files) of your dependencies, including the dependencies of your dependencies. This is necessary because a library can expose types that come from another package you do not install directly.
To reduce memory usage, follow the same steps as in Biome is slow.
Check what Biome sees
Section titled “Check what Biome sees”When Biome does not behave as you expect, for example because it ignores a file or a rule, the rage command prints the configuration and environment that Biome actually uses:
npx biome rage --linter --formatterpnpm biome rage --linter --formatterbunx biome rage --linter --formatterdeno run -A npm:@biomejs/biome rage --linter --formatteryarn biome rage --linter --formatterbiome rage --linter --formatterTo see what Biome does step by step, write its logs to a file with the BIOME_LOG_FILE and BIOME_LOG_LEVEL environment variables:
BIOME_LOG_FILE=biome-debug.log BIOME_LOG_LEVEL=debug biome check .Debug your editor
Section titled “Debug your editor”If the problem only happens in your editor, look at the logs of the Biome process that your editor uses.
Find the daemon logs
Section titled “Find the daemon logs”The Biome daemon, which editor extensions connect to, saves its logs in a folder called biome-logs. The location of this folder depends on your operating system:
- Linux:
~/.cache/biome - Windows:
C:\Users\<UserName>\AppData\Local\biomejs\biome\cache - macOS:
/Users/<UserName>/Library/Caches/dev.biomejs.biome
On other operating systems, the folder is in the system’s temporary directory. To print the exact path, run:
npx biome explain daemon-logspnpm biome explain daemon-logsbunx biome explain daemon-logsdeno run -A npm:@biomejs/biome explain daemon-logsyarn biome explain daemon-logsbiome explain daemon-logsBiome rotates the log files every hour. To include these logs in a bug report, add --daemon-logs to the rage command.
Record the LSP trace in VS Code
Section titled “Record the LSP trace in VS Code”When you report an issue with the VS Code extension, the Biome team may ask you for the LSP trace. Set the biome.lsp.trace.server setting to verbose and repeat the action that caused the issue. The trace appears in the Output panel, under the Biome LSP trace (xxx) option.
Report a problem
Section titled “Report a problem”If you are still stuck, open an issue and include:
- The output of
biome rage --linter --formatter. - A link to a repository that reproduces the problem, if you can share one.
- For performance issues, the number of files in your project and the timings you measured.
© 2023-present Biome developers and contributors.