首页 > 解决方案 > Nock - 无效的“扩展”配置值 tslint 错误

问题描述

在我开始在测试中使用 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 时,我没有看到错误。有没有人遇到过这个问题?

标签: tslintnock

解决方案


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


推荐阅读