# @genesislcap/oxlint-config

Published **Oxlint** rules for Genesis Foundation UI. This monorepo's own lint pipeline (**`npm run lint`**) runs **Oxlint only** — Oxlint → Oxfmt → Stylelint. [`@genesislcap/eslint-config`](../eslint-config/README.md) still exists and remains available for other packages/consumers that opt in to ESLint for stricter or type-aware checks Oxlint doesn't cover (see its README and the [Import rules and ESLint](#import-rules-and-eslint) section below for the specific gaps), but it is no longer part of this repo's own build/CI.

## What it does

- Ships **[`.oxlintrc.json`](./.oxlintrc.json)** — the only file you should edit for Oxlint rule changes in this product line.
- **Does not format code.** Formatting is **Oxfmt** — config lives in the root **`.oxfmtrc.json`** (copy it to your app, no extra package needed).

## How it runs in the monorepo

1. **`npm run lint`** / **`genx lint`** runs **Oxlint** (first, before Oxfmt and Stylelint) from the **current working directory**.
2. The repo root has a small [`.oxlintrc.json`](../../../../.oxlintrc.json) that **only** `extends` this package so `oxlint` finds the same rules from the workspace root.
3. Nested apps that run `genx lint` from their own folder may need a local stub `extends` (see Consumption) so config resolves correctly.

## Import rules and ESLint

Oxlint loads **`eslint-plugin-import`** as a **[JS plugin](https://oxc.rs/docs/guide/usage/linter/js-plugins.html)** under the alias **`import-es`** (avoids clashing with Oxlint’s built-in `import` plugin). In this config, `import-es` covers **`newline-after-import`**, **`no-self-import`**, **`no-useless-path-segments`** (warn), **`no-duplicates`** (warn), and **`no-extraneous-dependencies`** (error).

**Import ordering** is handled by **`import-es/order`** with the same groups and `alphabetize` config as `@genesislcap/eslint-config`, so both linters enforce identical ordering. `import-es/first` is disabled (redundant with `import-es/order`).

Native Oxlint **`import/*`** rules used here include **`no-absolute-path`** and **`no-mutable-exports`** — do not duplicate those as `import-es/*`.

JS plugins are **alpha** in Oxlint; **type-aware** TypeScript rules (e.g. `@typescript-eslint/no-shadow`) still require **ESLint** ([upstream limits](https://oxc.rs/docs/guide/usage/linter/js-plugins.html#api-support)). Two rare-trigger core rules, `no-unreachable-loop` and `require-atomic-updates`, also have no Oxlint implementation yet.

**When to run ESLint as well:** in a package that depends on `@genesislcap/eslint-config`, use **`genx lint -l eslint`** (or that package's own `lint:eslint`/`lint:with-eslint` script, if defined) when you need type-aware **`@typescript-eslint/*`** rules or finer `import/*` behavior. This monorepo's own root pipeline no longer runs ESLint, so those remaining gaps aren't enforced here — only in packages that opt in.

## Consumption

**In this repository:** change rules only in **this package’s** [`.oxlintrc.json`](./.oxlintrc.json). Keep the root stub in sync with the `extends` pattern below.

**Downstream:** installing `@genesislcap/oxlint-config` automatically brings in `oxlint`, `oxfmt`, and the required ESLint plugins as bundled dependencies — no separate installs needed. At your app root, add:

```json
{
  "devDependencies": {
    "@genesislcap/oxlint-config": "latest"
  }
}
```

Then create `.oxlintrc.json`:

```json
{
  "$schema": "./node_modules/oxlint/configuration_schema.json",
  "extends": ["./node_modules/@genesislcap/oxlint-config/.oxlintrc.json"]
}
```

And copy [`.oxfmtrc.json`](https://github.com/genesislcap/foundation-ui/blob/master/.oxfmtrc.json) from the `foundation-ui` repo for Oxfmt config (no extra package needed).

If you run Oxlint only from a **subfolder** of a monorepo, ensure a `.oxlintrc.json` in that folder can resolve the shared config (for example by extending a path or package that exists from that directory).

## Bundled dependencies

Shipped as `dependencies` in [`package.json`](./package.json) so they install automatically:

- `oxlint`
- `oxfmt`
- `eslint-import-resolver-typescript`
- `eslint-plugin-import`
- `eslint-plugin-unused-imports`
