打字稿。 ESLint 不适用于类型

TypeScript. TSLint does not wok in Types

所以我无法理解如何在 tslint.json 中进行标准化和激活半规则检查选项。因为现在它不检查也不为 TypeScript 中的 Types 产生任何错误。同样在 Interfaces 中,它正常工作并在我使用与 ; 不同的东西时抛出错误,那么我怎样才能使它也适用于 Types?...

export type IProps = {
    active?: boolean, // no error
    title?: string; // no error
    text?: string // no error
}

tslint.json:

{
  "defaultSeverity": "error",
  "extends": [
    "tslint-config-airbnb",
    "tslint-eslint-rules",
    "tslint-react"
  ],
  "jsRules": {},
  "rulesDirectory": [],
  "rules": {
    "arrow-parens": false,
    "whitespace": [
      false,
      "check-branch",
      "check-decl",
      "check-operator",
      "check-separator",
      "check-type"
    ],
  }
}

您正在寻找 type-literal-delimiter rule。只需在 tslint.json.

中将其从 false 更改为 true