Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the first variable in the options of ESLint's max-len setting?

Tags:

eslint

ESLint's max-len setting allows me to input two required options:

  1. The total number of characters allowed on each line of code. This character count includes indentation.
  2. The character count to use whenever a tab character is encountered.

However, when I look at the code they provide, it's:

"max-len": [2, 80, 4]

...or three options. Above this they reference a 2-character tab, which they show as:

"max-len": [1, 80, 2]

I assume the second and third options set the total characters allowed (80 in this case) and the length of a tab (2 or 4). What is the first option [1,... or [2,... defining?

like image 648
YPCrumble Avatar asked Jun 30 '15 22:06

YPCrumble


1 Answers

The first item in the array is the rule ID, which essentially turns the rule on or off. All remaining items in the array are passed to the rule as options.

Per the official documentation, a rule ID may be one of three values:

0 - turn the rule off
1 - turn the rule on as a warning (doesn't affect exit code)
2 - turn the rule on as an error (exit code is 1 when triggered)

like image 142
cvisco Avatar answered Sep 21 '22 17:09

cvisco