# Biome

Lint and check every package with a Biome config, cached per package.

The Biome plugin gives every package with a Biome config a `lint` task and a `check` task, so each package is linted and checked on its own and stays cached until something it reads changes.

## Add it

```sh
axle add biome
```

This writes it into the root `axle.toml`:

```toml
[plugins.biome]
source = "npm:@axle-rs/plugin-biome@0.1.0"
hash = "sha256-…"
```

## Tasks

A package or project with a `biome.json` or `biome.jsonc` in its folder, usually one with `"root": false` that extends the root config, gets:

| Task    | Command         | What it does                                                       |
| ------- | --------------- | ------------------------------------------------------------------ |
| `lint`  | `biome lint .`  | runs the linter                                                    |
| `check` | `biome check .` | runs the linter, the formatter and import sorting, without writing |

Each command runs through the repository's package manager, such as `pnpm exec biome check .`, so it uses the Biome the package installs. Both tasks have the same settings:

| Setting   | Value                                                    | Why                                                                                    |
| --------- | -------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `inputs`  | `["default", "{root}/biome.json", "{root}/biome.jsonc"]` | every file of the package, its own config among them, and the root config it extends   |
| `outputs` | `[]`                                                     | neither writes anything, so they can run at the same time as the package's other tasks |

## Scripts the repository already has

A package's own script wins. When its `package.json` has a script with a task's name that runs something else, such as `"check": "biome check --write ."`, the plugin leaves that task alone and Axle runs the script. A script of `biome lint` or `biome check`, with or without the `.`, is replaced by the plugin's task, which runs the same command and adds its settings.

## Settings

| Setting | Default   | Meaning                                               |
| ------- | --------- | ----------------------------------------------------- |
| `lint`  | `"lint"`  | the name of the lint task, or `false` to leave it out |
| `check` | `"check"` | the name of the check task, or `false`                |

The plugin's answers are kept until a `biome.json`, a `biome.jsonc`, a `package.json`, `pnpm-workspace.yaml` or a lockfile changes.
