# ESLint (@ovineko/spa-guard-eslint)

> ESLint plugin with rules that enforce spa-guard usage patterns: `no-direct-lazy` and `no-direct-error-boundary`.

# @ovineko/spa-guard-eslint

ESLint plugin with rules that enforce spa-guard usage patterns: `no-direct-lazy` and `no-direct-error-boundary`.

## Install

<Tabs>
  <TabItem value="pnpm" label="pnpm" default>
    ```bash
    pnpm add -D @ovineko/spa-guard-eslint eslint
    ```
  </TabItem>
  <TabItem value="npm" label="npm">
    ```bash
    npm install --save-dev @ovineko/spa-guard-eslint eslint
    ```
  </TabItem>
  <TabItem value="yarn" label="yarn">
    ```bash
    yarn add -D @ovineko/spa-guard-eslint eslint
    ```
  </TabItem>
  <TabItem value="bun" label="bun">
    ```bash
    bun add -d @ovineko/spa-guard-eslint eslint
    ```
  </TabItem>
  <TabItem value="deno" label="deno">
    ```bash
    deno add npm:@ovineko/spa-guard-eslint npm:eslint
    ```
  </TabItem>
</Tabs>

## Usage

Add the recommended config to your `eslint.config.js` (flat config):

```js

export default [
  spaGuard.configs.recommended,
  // ... your other configs
];
```

The recommended config enables both rules at `"error"` level with autofixes.

## Rules

### `no-direct-lazy`

Disallows importing `lazy` from `react`. Use `lazyWithRetry` from `@ovineko/spa-guard-react` instead.

```ts
// Bad - flagged by the rule

// Good - autofix replaces it with:

```

### `no-direct-error-boundary`

Disallows importing from `react-error-boundary`. Use `@ovineko/spa-guard-react/error-boundary` instead.

```ts
// Bad - flagged by the rule

// Good - autofix replaces it with:

```

Both rules provide autofixes and are fixable via `eslint --fix`.

## API

- `plugin` (default export) - ESLint plugin object with `rules` and `configs`
- `configs` - Named export; `configs.recommended` is the flat config object
- `rules` - Named export; object with `no-direct-lazy` and `no-direct-error-boundary`

## Related packages

- [@ovineko/spa-guard](./core) — Core package
- [@ovineko/spa-guard-react](./react) — React integration (lazyWithRetry, ErrorBoundary)
