# @rsbuild/plugin-eslint

Latest version **2.0.2** (published 2026-06-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rsbuild/plugin-eslint
pnpm add @rsbuild/plugin-eslint
yarn add @rsbuild/plugin-eslint
bun add @rsbuild/plugin-eslint
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2026-06-05 |
| First published | 2024-02-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=20.20.2 |
| Dependencies | 1 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 4 |
| Maintainers | chenjiahan, hardfist |

## Links

- npm: https://www.npmjs.com/package/@rsbuild/plugin-eslint
- Repository: https://github.com/rstackjs/rsbuild-plugin-eslint
- npm.io page: https://npm.io/package/@rsbuild/plugin-eslint

## Dependencies (1)

- [eslint-rspack-plugin](https://npm.io/package/eslint-rspack-plugin.md) 5.0.1

## Recent versions

- 2.0.2 (latest) — 2026-06-05
- 1.0.0-alpha.3 (alpha) — 2024-07-04
- 0.0.0-next-20240528072128 (next) — 2024-05-28
- 0.7.0-beta.9 (beta) — 2024-05-24
- 2.0.1 — 2026-05-28
- 2.0.0 — 2026-05-13
- 1.3.0 — 2026-02-25
- 1.2.1 — 2026-01-15
- 1.2.0 — 2025-12-05
- 1.1.2 — 2025-08-04
- 1.1.1 — 2025-02-16
- 1.1.0 — 2024-12-01
- 1.0.4 — 2024-09-30
- 1.0.3 — 2024-09-10
- 1.0.2 — 2024-08-20
- … 69 more at https://npm.io/package/@rsbuild/plugin-eslint/versions

## README

# @rsbuild/plugin-eslint

An Rsbuild plugin to run ESLint checks during the compilation.

The plugin has integrated [eslint-rspack-plugin](https://www.npmjs.com/package/eslint-rspack-plugin) internally.

> We do not recommend using the `@rsbuild/plugin-eslint` plugin, as running ESLint during the build process will significantly increase the build time. Instead, we recommend using a separate `lint` command to run ESLint checks.

<p>
  <a href="https://npmjs.com/package/@rsbuild/plugin-eslint">
   <img src="https://img.shields.io/npm/v/@rsbuild/plugin-eslint?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" />
  </a>
  <img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" />
  <a href="https://npmcharts.com/compare/@rsbuild/plugin-eslint?minimal=true"><img src="https://img.shields.io/npm/dm/@rsbuild/plugin-eslint.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
</p>

<img width="1496" src="https://github.com/user-attachments/assets/ee4b1915-92ce-4032-834d-b2321f02f1d2" />

## Usage

Install:

```bash
npm add @rsbuild/plugin-eslint -D
```

The latest version of this plugin only supports ESLint >= 9.0 and Node.js 20+.
If you need to use ESLint v8 or Node.js 18, install the `1.x` version instead:

```bash
npm add @rsbuild/plugin-eslint@1 -D
```

Add plugin to your `rsbuild.config.ts`:

```ts
// rsbuild.config.ts
import { pluginEslint } from '@rsbuild/plugin-eslint';

export default {
  plugins: [pluginEslint()],
};
```

## Example Projects

- [React + ESLint project](https://github.com/rstackjs/rspack-examples/tree/main/rsbuild/react-eslint)
- [Vue 3 + ESLint project](https://github.com/rstackjs/rspack-examples/tree/main/rsbuild/vue3-eslint)

## Options

### enable

Whether to enable ESLint checking.

- **Type:** `boolean`
- **Default:** `true`
- **Example:**

Disable ESLint checking:

```js
pluginEslint({
  enable: false,
});
```

Enable ESLint checking only during production builds:

```js
pluginEslint({
  enable: process.env.NODE_ENV === 'production',
});
```

Enable ESLint checking only during development builds:

```js
pluginEslint({
  enable: process.env.NODE_ENV === 'development',
});
```

### environments

Control which environments to run ESLint on when using [Rsbuild's multi-environment builds](https://rsbuild.rs/guide/advanced/environments).

- **Type:** `'all' | boolean | string[]`
- **Default:** `false`
- **Example:**

By default, ESLint only runs on the first environment to avoid running multiple times:

```js
pluginEslint({
  environments: false, // (default)
});
```

Run ESLint on all environments:

```js
pluginEslint({
  environments: 'all',
  // or
  environments: true,
});
```

Run ESLint on specific environments by name:

```js
pluginEslint({
  environments: ['web', 'node'],
});
```

This is useful when different environments have different entry points and you want to ensure all files are linted. Note that when set to `'all'` or `true`, ESLint will run separately for each environment, which may increase build time.

### eslintPluginOptions

To modify the options of `eslint-rspack-plugin`, please refer to [eslint-rspack-plugin - README](https://github.com/rstackjs/eslint-rspack-plugin#readme) to learn about available options.

- **Type:** [Options](https://github.com/rstackjs/eslint-rspack-plugin#options)
- **Default:**

```ts
const defaultOptions = {
  extensions: ['js', 'jsx', 'mjs', 'cjs', 'ts', 'tsx', 'mts', 'cts'],
  exclude: [
    'node_modules',
    'dist', // -> rsbuildConfig.output.distPath.root
  ],
};
```

The `eslintPluginOptions` object will be shallowly merged with the default configuration object.

- `eslint-rspack-plugin` v5 uses flat config by default. For legacy `.eslintrc` config, set `configType: 'eslintrc'`:

```ts
pluginEslint({
  eslintPluginOptions: {
    cwd: __dirname,
    configType: 'eslintrc',
  },
});
```

- For example, exclude some files using `exclude`:

```ts
pluginEslint({
  eslintPluginOptions: {
    exclude: ['node_modules', 'dist', './src/foo.js'],
  },
});
```

- Extend `extensions` to validate `.vue` or `.svelte` files:

```ts
pluginEslint({
  eslintPluginOptions: {
    extensions: ['js', 'jsx', 'mjs', 'cjs', 'ts', 'tsx', 'mts', 'cts', 'vue'],
  },
});
```

## License

[MIT](./LICENSE).

---
_Source: https://npm.io/package/@rsbuild/plugin-eslint · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
