如何使用 eslint 在 Typescript 中强制执行多行“if”条件缩进?

Mar*_*Sol 5 javascript typescript eslint typescript-eslint

我正在尝试使用 Typescript 配置 eslint 以支持 Java 的多行if缩进标准。

作为记录,Java 标准指定if用于复杂ifs的多行条件应该缩进两次:

if (
        a >= MIN && a <= MAX ||
        b >= MIN && b <= MAX
) {
    alert("Either value is out of range");
}
Run Code Online (Sandbox Code Playgroud)

似乎没有if特定条件,所以我尝试使用MemberExpression,CallExpressionFunctionExpression类型,但似乎都不起作用:

我的缩小版.eslintrc.json如下:

{
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended"
  ],
  "env": {
    "browser": true,
    "mocha": true
  },
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": 2015,
    "sourceType": "module",
    "project": "tsconfig.json"
  },
  "plugins": [
    "@typescript-eslint/eslint-plugin"
  ],
  "rules": {
        /* here goes more rules */
    "@typescript-eslint/indent": ["warn", "tab", { "MemberExpression": 2, "CallExpression": {"arguments": 2}, "SwitchCase": 1, "FunctionExpression": {"body": 1, "parameters": 2} }]
        /* more rules here too */
  }
}
Run Code Online (Sandbox Code Playgroud)

我在控制台上收到以下错误:

256:1 warning Expected indentation of 3 tabs but found 4 @typescript-eslint/indent

我在 Typescript 中缺少用于配置所述ifs 的任何设置吗?