# Oxlint

Lint every package with an Oxlint config, cached per package.

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

## Add it

```sh
axle add oxlint
```

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

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

## Tasks

A package or project with a `.oxlintrc.json` or an `oxlint.config` file, `.ts`, `.mts`, `.cts`, `.js`, `.mjs` or `.cjs`, in its folder gets a `lint` task, `oxlint`. The command runs through the repository's package manager, such as `pnpm exec oxlint`, so it uses the Oxlint the package installs.

| Setting   | Value                                                            | Why                                                                                        |
| --------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| `inputs`  | `["default", "{root}/.oxlintrc.json", "{root}/oxlint.config.*"]` | every file of the package, its own config among them, and the root config it often extends |
| `outputs` | `[]`                                                             | Oxlint writes nothing, so the task can run at the same time as the package's other tasks   |

A package whose config extends a file elsewhere in the repository, other than the root config, adds it in `axle.toml`:

```toml
[tasks.lint]
inputs = ["...", "{root}/tools/oxlint/**"]
```

## Scripts the repository already has

A package's own script wins. When its `package.json` has a `lint` script that runs something else, such as `oxlint --fix`, the plugin leaves the task alone and Axle runs the script. A `lint` script of `oxlint` or `oxlint .` 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 task, or `false` to leave it out |

The plugin's answers are kept until a `.oxlintrc.json`, an `oxlint.config.*`, a `package.json`, `pnpm-workspace.yaml` or a lockfile changes.
