/eslint-plugin-switch-error-warn

Downgrade errors to warnings

Primary LanguageJavaScript

eslint-plugin-switch-error-warn

Switch errors to warnings and visa versa

This is a fork of eslint-plugin-only-warn, modified to flip error and warn statuses on messages rather than downgrading all to warn status. This allows the default to still be warn whilst allowing a crude form of exceptions to the default.

This does mean that the rules that would normally default to warn must be changed to error if you want them to still only trigger warnings (e.g. 'no-console').

DISCLAIMER: I made this fork very quickly, for my own use. Use if useful, I would not consider this good practice at all in general.

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-switch-error-warn:

$ npm install eslint-plugin-switch-error-warn --save-dev

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

Usage

Add switch-error-warn to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "switch-error-warn"
    ]
}