javascript - eslint "indent"规则的第一个参数是什么

标签 javascript eslint

我在使用 eslit 的项目上有一个简单的配置

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

根据文档,第二个“2”是用于缩进的空格数(可以设置为 4 或 6 或“制表符”)。
第一个“2”怎么样?

Old documentation此处使用“2”,而 New documentation使用“错误”

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

两人都没有提及此事。这是做什么用的?

最佳答案

参见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 与“错误”相同。

关于javascript - eslint "indent"规则的第一个参数是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56836612/

相关文章:

javascript - 查看源书签 : Retrieve original source?

javascript - Eslint 的正确 YAML - 值不应超过 1 个项目 - 无多个空行

javascript - 为什么在表达式前使用 '!!' ?

javascript - eslint Warning Unexpected unnamed async function ,无论如何要摆脱它?

javascript - 如何从 Observable<Array<any>> 中删除特定元素

javascript - 无法解决 JavaScript 中的 Promise

javascript检查输入字段不为空并检查输入字段长度?

javascript - 为什么我必须在 IE 中单击两次选择框选项才能使其消失?

javascript - 如何同时使用不同的 eslint 配置来 lint JS 和 TS 文件?

javascript - 如何忽略某些错误? eslint no-ex-assign 提示