【问题标题】:TypeScript. TSLint does not wok in Types打字稿。 ESLint 在类型中不起作用
【发布时间】:2019-03-16 14:47:20
【问题描述】:

所以我无法理解如何在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"
    ],
  }
}

【问题讨论】:

  • 你的 tslint.json 中有什么
  • @wgcrouch 给你

标签: javascript typescript tslint


【解决方案1】:

您正在寻找type-literal-delimiter rule。只需将 tslint.json 中的 false 更改为 true

【讨论】:

    猜你喜欢
    • 2018-04-30
    • 2016-03-06
    • 2015-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-16
    • 2018-12-25
    相关资源
    最近更新 更多