Home

Awesome

eslint-plugin-only-warn

status

Downgrade ESLint errors to warnings.

Installation

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

Usage

Using flat config files:

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

export default [
  ...

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

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:

{
  "plugins": ["only-warn"]
}
</details>

--max-warnings=0

Add --max-warnings=0 to the eslint command in package.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 and lint-staged to prevent committing code that contain eslint warnings.

Why only warnings?