Skip to content

Commit

Permalink
fix: take Ema's review into account
Browse files Browse the repository at this point in the history
  • Loading branch information
Conaclos committed Jul 20, 2024
1 parent a95978e commit 31ba50d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
26 changes: 11 additions & 15 deletions src/content/docs/guides/configure-biome.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A Biome configuration file is named `biome.json` or `biome.jsonc`.
It is usually placed in your project's root directory, next to your project's `package.json`.

Because Biome is a toolchain, its configuration is organized around the tools it provides.
At the moment, Biome provides three tools: the formatter, the linter and the import organizer (also called the import sorter).
At the moment, Biome provides three tools: the formatter, the linter and the import sorter (also called the import organizer).
All of these tools are enabled by default.
You can disable one or several of them using the `<tool>.enabled` field:

Expand All @@ -39,11 +39,11 @@ You can disable one or several of them using the `<tool>.enabled` field:
}
```

Options that apply to any language are placed in the corresponding tool field.
Options that apply to more than one language are placed in the corresponding tool field.
Language-specific options of a tool are placed under a `<language>.<tool>` field.
This also allows overriding general options for a given language.
You can also enable or disable a tool based on the language.
In the following example, we configure the general options `formatter.indentStyle` and `formatter.lineWidth` for all the supported languages.
In the following example, we configure the general options `formatter.indentStyle` and `formatter.lineWidth` for all the languages.
Also, we set the JavaScript-specific option `quoteStyle` in `javascript.formatter` and we override `formatter.lineWidth`.
We disabled the formatter for JSON files.

Expand All @@ -69,7 +69,7 @@ We disabled the formatter for JSON files.

:::note
Biome refers as `javascript` all variants of the JavaScript language.
This includes TypeScript and JSX.
This includes TypeScrip, JSX and TSX.
:::


Expand Down Expand Up @@ -105,11 +105,11 @@ Biome doesn't support nested `biome.json` files, neither in CLI nor in LSP. [Fol
:::

:::note
Biome commands support using the `--config-path` option.
Biome commands support using the `--config-path` option and the `BIOME_CONFIG_PATH` environment variable.
This allows you to specify a custom configuration file or a directory where Biome can look for a `biome.json` or `biome.jsonc` file.
When you use `--config-path`, the standard configuration file resolution process is **disabled**.
When you use `--config-path` or `BIOME_CONFIG_PATH`, the standard configuration file resolution process is **disabled**.

If `--config-path` points directly to a file, you can use names other than `biome.json` or `biome.jsonc`.
If `--config-path` or `BIOME_CONFIG_PATH` points directly to a file, you can use names other than `biome.json` or `biome.jsonc`.
Biome will read a `.json` file using a standard JSON parser.
For files with other extensions, Biome will treat them as `.jsonc` files, using a more flexible JSON parser that allows comments and trailing commas.
:::
Expand Down Expand Up @@ -170,7 +170,7 @@ To avoid a breaking change with how the existing resolution works, paths startin
For more information about the resolution algorithm, refer to the [Node.js documentation](https://nodejs.org/api/esm.html#resolution-and-loading-algorithm).


## Ignoring files
## Ignore files

The first way to control which files and directories are processed by Biome is to list them in the CLI.
In the following command, we format only `file1.js` and all the files in the `src` directory.
Expand All @@ -189,17 +189,14 @@ Some shells don't support the recursive glob `**`.
The Biome configuration file can be used to refine which files are processed.
You can explicitly list the files to be processed using `include` and the files not to be processed using `ignore`.
`include` and `ignore` accepts globs patterns such as `src/**/*.js`.
See the related section for which glob syntaxes are supported.
See the [related section](#glob-syntax-explained) for which glob syntaxes are supported.
`include` is always applied first before applying `ignore`.
This allows you to include some files and to ignore some of the file you included.

:::note
`include` and `ignore` have a slightly different semantics.
`ignore` applies to both regular files and folders,
while `include` is only tested on regular files.
This means that if you want to prevent Biome from traversing a folder,
you have to add the folder to `ignore`.
This is a current limitation that we will fix in a future release.
`include` doesn't prevent Biome of traversing a folder.
This means that if you want to prevent Biome from traversing a folder, you have to add the folder to `ignore`.
:::

Biome provides global `files.include` and `files.ignore` fields that apply to all tools.
Expand Down Expand Up @@ -381,7 +378,6 @@ Some examples:
Biome uses a glob library that treats all globs as having a `**/` prefix.
This means that `src/**/*.js` and `**/src/**/*.js` are treated as identical.
They match both `src/file.js` and `test/src/file.js`.
This is something we plan to fix in Biome **v2.0.0**, as it will be a breaking change.

:::caution
These patterns can be used in a Biome configuration file.
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import NumberOfRules from "@/components/generated/NumberOfRules.astro";
<div class="hero-code">
<h2 class="head">Format code like Prettier, save time</h2>

**Biome is a [fast formatter](https://github.com/biomejs/biome/tree/main/benchmark#formatting)** for _JavaScript_, _TypeScript_, _JSX_, and _JSON_ that scores **[97% compatibility with _Prettier_](https://console.algora.io/challenges/prettier)**, **saving CI and developer time**.
**Biome is a [fast formatter](https://github.com/biomejs/biome/tree/main/benchmark#formatting)** for _JavaScript_, _TypeScript_, _JSX_, _TSX_ and _JSON_ that scores **[97% compatibility with _Prettier_](https://console.algora.io/challenges/prettier)**, **saving CI and developer time**.

Biome can even **format malformed code** as you write it in [your favorite editor](/guides/integrate-in-editor/).

Expand Down

0 comments on commit 31ba50d

Please sign in to comment.