Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/content/docs/guides/configure-biome.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ Here's an example:
- Biome commands that run in `app/frontend/legacy/package.json` and `app/frontend/new/package.json`
will use the configuration file `app/frontend/biome.json`;

:::caution
Biome doesn't yet support nested `biome.json` files, neither in CLI nor in LSP.
[Follow and help the support in the related issue](https://github.com/biomejs/biome/issues/2228)
:::note
Please refer [Monorepo](/guides/big-projects#monorepo) if you want to use Biome in a monorepo project.
:::


Expand Down Expand Up @@ -206,7 +205,7 @@ and use the negated patterns, using the leading `!`.

Before listing the negated globs, **they must be preceded by the `**` pattern**.

In the following example, we tell Biome to include files, excluded the `dist` directory, and all files that have `.generated.js` in their name
In the following example, we tell Biome to include files, excluded the `dist` directory, and all files that have `.generated.js` in their name:

```json title="biome.json"
{
Expand Down
103 changes: 77 additions & 26 deletions src/content/docs/ja/guides/big-projects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: 大規模プロジェクトでのBiomeの使用方法
description: 大規模プロジェクトでBiomeを使用するための簡単なガイド
---

import {FileTree} from '@astrojs/starlight/components';
import {FileTree, Steps} from '@astrojs/starlight/components';

Biomeは、モノレポや複数のプロジェクトを含むワークスペースなどの大規模なプロジェクトで、適切に使用するためのツールを提供しています。

Expand Down Expand Up @@ -98,30 +98,81 @@ Biomeの機能をCLIやLSPで使用する場合、ツールは現在の作業デ

モノレポは、複数のライブラリを単一の大きなリポジトリに保存して管理されるリポジトリです。それぞれのライブラリは独立したプロジェクトであり、異なる構成を持つことがあります。

Biomeはネストされた設定ファイルの解決においていくらかの制限があり、モノレポを適切にサポートしていません。[関連したIssueを手伝い、フォロー](https://github.com/biomejs/biome/issues/2228)してください。

現在の制限の下でより良い開発者体験を実現するには、モノレポのルートに `biome.json` を配置し、[`overrides`](/reference/configuration/#overrides) 設定を使っていくつかのパッケージでBiomeの動作を変更することを推奨しています。

以下の例では、パッケージ `packages/logger` の中ではルール `suspecious/noConsoleLog` を無効化しています。

```json title="biome.jsonc"

{
"linter": {
"enabled": true,
"rules": {
"recommended": true
v2以降では、Biomeはモノレポをサポートしており、以下のようにプロジェクトを準備する必要があります:

<Steps>
1. モノレポのルートに `biome.json` ファイルを作成します。推奨されたルールを使い、フォーマッタのオプションをカスタマイズします。:

```json title="biome.json"
{
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"formatter": {
"lineWidth": 120,
"indentStyle": "space",
"indentWidth": 6,
}
}
},
"overrides": [{
"include": ["packages/logger/**"],
"linter": {
"rules": {
"suspicious": {
"noConsoleLog": "off"
}
```
このファイルは**ルートの設定**と呼ばれ、プロジェクト内の基本的なオプションを設定します。ただし、ネストされた設定はこれらのオプションに従うかどうかを決めることができます。見てみましょう。

2. 必要な各パッケージに一つずつ、ネストされた設定ファイルを作成します。これらのネストされた設定ファイルは `"root"` フィールドを `false` にしている必要があります。
していない場合はエラーになります。
加えて、これらのパッケージはルートの設定で指定したフォーマットの標準に従うようにしましょう。
そのために、Biome v2 で追加された**新しいマイクロ構文**である `"extends": "//"` を利用します。
この構文はネストされた設定がどこにあるかに関わらず、**ルートの設定**を継承するようBiomeに指示します。

一つは `packages/logger` の中に、もう一つは `packages/generate` の中に、合わせて二つの設定ファイルを作成しましょう。
前者では `noConsole` を無効化し、 `packages/generate` ではコード生成されたファイルのフォーマッタを無効化します:

```json title="packages/logger/biome.json"
{
"root": false,
"extends": "//",
"linter": {
"rules": {
"suspicious": {
"noConsole": "off"
}
}
}
}
}]
}
```
}
```

```json title="packages/generate/biome.json"
{
"root": false,
"extends": "//",
"formatter": {
"enabled": false
}
}
```
しかし、 `extends: "//"` のマイクロ構文を使うときは、この設定はルートの設定ではなく、ルートの設定を継承することが明らかなので、 `"root": false` を**省略**できます:

```diff title="packages/generate/biome.json"
{
- "root": false,
"extends": "//",
"formatter": {
"enabled": false
}
```
3. ここで、とても異なるコーディング標準を持った別のチームによって、`packages/analytics` に新しいパッケージが追加されたと仮定しましょう。
これらのオプションを変更するには、設定ファイルから `"extends": "//"` を省略して、フォーマットのオプションを変更するだけです:
```json title="packages/analytics/biome.json"
{
"root": false,
"formatter": {
"lineWidth": 100,
}
}

```
4. これですべての準備は整いました。`biome` コマンドをプロジェクトのルートから実行することも、単一のパッケージから実行することもできます。
Biomeはすべての設定に従います!
</Steps>
Loading
Loading