# eslint-plugin-only-warn

> Downgrade errors to warnings

Latest version **1.2.1** (published 2026-02-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-only-warn
pnpm add eslint-plugin-only-warn
yarn add eslint-plugin-only-warn
bun add eslint-plugin-only-warn
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2026-02-28 |
| First published | 2017-05-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 184 |
| Author | Bob Fanger |
| Maintainers | bfanger |
| Keywords | eslint, eslintplugin, eslint-plugin |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-only-warn
- Repository: https://github.com/bfanger/eslint-plugin-only-warn
- Issues: https://github.com/bfanger/eslint-plugin-only-warn/issues
- npm.io page: https://npm.io/package/eslint-plugin-only-warn

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 1.2.1 (latest) — 2026-02-28
- 1.2.0 — 2026-02-28
- 1.1.0 — 2022-12-03
- 1.0.3 — 2021-07-26
- 1.0.2 — 2019-12-25
- 1.0.1 — 2017-07-07
- 0.0.1 — 2017-05-23

## README

# eslint-plugin-only-warn

![status](https://github.com/bfanger/eslint-plugin-only-warn/actions/workflows/lint-and-test.yml/badge.svg)

Downgrade [ESLint](http://eslint.org) errors to warnings.

## Installation

```sh
npm install --save-dev eslint-plugin-only-warn
```

## Usage

Using [flat config files](https://eslint.org/docs/latest/use/configure/configuration-files):

```js
// eslint.config.js
import "eslint-plugin-only-warn";

export default [
  ...
```

Or, when the package.json that doesn't have `"type": "module"`:

```js
require("eslint-plugin-only-warn");
```

<details>
  <summary>ESLint 8.x and earlier</summary>

Add `only-warn` to the plugins section of your `.eslintrc` configuration file:

```json
{
  "plugins": ["only-warn"]
}
```

</details>

### --max-warnings=0

Add [--max-warnings=0](https://eslint.org/docs/latest/use/command-line-interface#--max-warnings) to the eslint command in package.json

```json
  "lint": "eslint --max-warnings=0 ...",
```

Adding the option allows git hooks or CI pipelines to detect failed linting rules.  
Because the cli now has a nonzero exitcode when it encountered linting warnings.

### Git integration

Use [Husky](https://typicode.github.io/husky/) and [lint-staged](https://github.com/okonet/lint-staged) to prevent committing code that contain eslint warnings.

# Why only warnings?

- Don't waste time thinking or discussing about when a rule should be an error or a warning, focus on enabling of disabling a rule
- Warnings look different in editors, this allows you to quickly see that some tweaking is required, but your code still runs (ESLint rules generally don't block the code from executing and fatal errors are still reported as error)
- Prevents noise, disallowing warnings to be committed in a codebase prevents clutter in the output of ESLint (use [special eslint comments](https://eslint.org/docs/latest/use/configure/rules#disable-rules) for the instances when you need an exception to the rules)

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