What is the first argument to eslint "indent" rule

Viewed 365

I have a simple config on the project that uses eslit

"rules": {
    "indent": [2, 2, {"SwitchCase": 1}]
}

According to documentation, second '2' is for number of spaces used for indent (can be set to 4 or 6 or "tab").
What about the first '2'?

Old documentation uses '2' here while New documentation uses "error"

"indent": ["error", "tab"]

Both say nothing about it. What is it for?

2 Answers

See the general documentation for configuring rules:

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

2 is the same as "error".

I found a reference on the github repository: https://github.com/eslint/eslint#configuration

"off" or 0 - turn the rule off

"warn" or 1 - turn the rule on as a warning (doesn't affect exit code)

"error" or 2 - turn the rule on as an error (exit code will be 1)

This explain all options for the first param.

Related