Socket
Socket
Sign inDemoInstall

eslint-plugin-only-warn

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eslint-plugin-only-warn

Downgrade errors to warnings


Version published
Weekly downloads
177K
decreased by-5.27%
Maintainers
1
Install size
5.86 kB
Created
Weekly downloads
 

Readme

Source

eslint-plugin-only-warn

status

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-only-warn:

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

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-only-warn globally.

Usage

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

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

Add --max-warnings=0 to the lint script in your package.json.

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

This will make eslint cli report an errorcode which can be detected in git hook or CI pipeline.

Tip: Use husky and lint-staged te prevent committing eslint warnings.

Why only warnings?

  • Don't waste time thinking or discussing about if it 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 for the instances when you need an exception to the rules)

Keywords

FAQs

Last updated on 03 Dec 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc