0.0.15 • Published 2 years ago

eslint-plugin-no-unary-expression v0.0.15

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

description: 'Disallow unary expressions for number string | null or string | undefined or number | null or number | undefined on if statements'

Installation

npm i --save-dev eslint-plugin-no-unary-expression
or
yarn add --dev eslint-plugin-no-unary-expression

Usage

In your .eslintrc add eslint-plugin-no-unary-expression to the plugin section.

{
  "plugins": ["eslint-plugin-no-unary-expression"],
  "rules": {
    "no-unary-expression/no-unary-expression": 2
  }
}

Rule Details

The following expressions are checked:

  • number | null
  • number | undefined
  • string | null
  • string | undefined

Examples of code for this rule:

❌ Incorrect

let a = [1,2,3];
let b = a.find(item => item === 7);
if (!b) {}

✅ Correct

let a = [1,2,3];
let b = a.find(item => item === 7);
if (b !== undefined) {}
0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago