TSLint不会抱怨缺少进口商品

问题描述 投票:0回答:1

TSLint不会抱怨缺少导入(但是,我在代码中留下console.log语句是不正确的)。 Linter说我的代码没有问题,但是它不能编译。如何配置TSLint以抱怨缺少导入问题?

这是我的TSLint配置:

{
  "extends": ["tslint:latest", "tslint-react", "tslint-react-hooks", "tslint-config-prettier"],
  "rulesDirectory": [],
  "rules": {
    "max-line-length": {
      "options": [120]
    },
    "new-parens": true,
    "no-arg": true,
    "no-conditional-assignment": true,
    "no-consecutive-blank-lines": false,
    "no-console": {
      "severity": "warning",
      "options": ["debug", "log", "time", "timeEnd", "trace"]
    },
    "interface-name": false,
    "no-empty-interface": false,
    "object-literal-sort-keys": false,
    "arrow-parens": false,
    "no-namespace": false,
    "no-submodule-imports": false,
    "no-implicit-dependencies": false,
    "variable-name": false,
    "no-conditional-assignment": false,
    "jsx-no-lambda": false,
    "only-arrow-functions": false,
    "object-literal-sort-keys": false,
    "ordered-imports": false,
    "no-string-literal": false,
    "no-bitwise": false,
    "ban-types": {
      "options": []
    },
    "typedef": true,
    "prefer-for-of": false,
    "no-duplicate-imports": false,
    "no-empty": { "severity": "warning" },
    "no-require-imports": { "severity": "warning" },
    "no-var-requires": { "severity": "warning" }
  },
  "jsRules": {
    "max-line-length": {
      "options": [120]
    },
    "no-console": {
      "severity": "warning",
      "options": ["debug", "log", "time", "timeEnd", "trace"]
    }
  }
}
typescript tslint
1个回答
0
投票

我认为原因是您或库declare.d.ts之类的地方导入的内容。在这种情况下,如果您不导入,则打字稿类型系统不能抱怨它,因为它可能是全局的。

© www.soinside.com 2019 - 2024. All rights reserved.