【问题标题】:Nock - Invalid "extends" configuration value tslint errorNock - 无效的“扩展”配置值 tslint 错误
【发布时间】:2020-02-01 16:16:41
【问题描述】:

在我开始在测试中使用 nock 后,我收到以下 tslint 错误。

Failed to load <project-folder>\node_modules\nock\types\tslint.json: Invalid "extends" configuration value - could not require "dtslint/dtslint.json". Review the Node lookup algorithm (https://nodejs.org/api/modules.html#modules_all_together) for the approximate method TSLint uses to find the referenced configuration file.

节点版本 - 10.16.2 Nock 版本 - 11.3.5

TSLint 配置

  "defaultSeverity": "error",
  "extends": ["tslint:recommended", "tslint-config-prettier"],
  "jsRules": {},
  "rules": {
    "ordered-imports": [false],
    "object-literal-sort-keys": false
  },
  "rulesDirectory": [],
  "linterOptions": {
    "exclude": ["node_modules/**"]
  }
} 

json 包中的测试脚本 tslint --project tsconfig.json **/*.ts && jest --colors --coverage --passWithNoTests

当我使用 nock 版本 10.0.6 时,我看不到错误。有没有人遇到过这种情况?

【问题讨论】:

  • Nock 仅开始将其自己的类型与 v11.3 捆绑在一起,这就是为什么您在 v10 上没有看到问题的原因。至于问题本身,你能用你的 TSLint 配置更新你的问题吗?还请提供一个 TSLint 执行方式的示例。
  • 我无法使用该配置重现该问题。你能指定你使用的是哪个版本的 TSLint。同时,它 Nock 不需要发布它的 tslint.json。我会打开一个 PR 来删除它。
  • 我使用的是 TSLint 5.19.0 版。 Nock 正在尝试扩展不存在的 dtslint json。
  • 问题是 tslint 在 node_modules 中使用了一个 tslint.json 文件。由于我没有从其他人那里听说过这个问题,我不得不假设它与您的配置有关。
  • 这可能会有所帮助:github.com/palantir/tslint/issues/3430

标签: tslint nock


【解决方案1】:

当我遇到这个问题时,通过运行:npm install --save dtslint

【讨论】:

  • 没有帮助:(
猜你喜欢
  • 2019-01-20
  • 2017-04-06
  • 2020-04-10
  • 1970-01-01
  • 2021-02-03
  • 1970-01-01
  • 1970-01-01
  • 2019-03-11
相关资源
最近更新 更多