Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the number in eslint rule arrays mean?

I'm totally new to eslint configurations. I'm using tslint for typescript for quite a while now so I'm familiar with the concept.

eslint uses for many rules a syntax like

"no-cond-assign": [2, "always"] 

or just

"no-constant-condition": 2 

What does the number mean? The documentation is pretty huge and I'm not able to google or find it in the docs on the fly

like image 921
boop Avatar asked Dec 10 '15 01:12

boop


People also ask

What does 2 mean in ESLint rules?

I defines the severity of a rule. Severity should be one of the following: 0 = off, 1 = warning, 2 = error (you passed "3"). Documentation: https://eslint.org/docs/user-guide/configuring/rules.

What are ESLint errors?

ESLint can call out logic errors, such as update code in a for loop that iterates in the wrong direction. It can also call your attention to unused code, such as empty block statements which can indicate something like an incomplete refactoring process.

How many ESLint rules are there?

Keep in mind that we have over 200 rules, and that is daunting both for end users and the ESLint team (who has to maintain them).


1 Answers

I've found it myself by using another number than 0,1 or 2. I defines the severity of a rule.

Severity should be one of the following: 0 = off, 1 = warning, 2 = error (you passed "3"). 

Documentation: https://eslint.org/docs/user-guide/configuring/rules

like image 183
boop Avatar answered Sep 30 '22 23:09

boop