3

I'm getting the below tslint error after i started using nock in my tests.

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.

Node version - 10.16.2 Nock version - 11.3.5

TSLint Config

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

Test script in package json tslint --project tsconfig.json **/*.ts && jest --colors --coverage --passWithNoTests

When i use nock version 10.0.6, i don't see the error. Has anyone faced this before?

Mahendra R
  • 101
  • 2
  • 5
  • Nock only started bundling its own types with v11.3, which is why you're not seeing the issue on v10. As for the issue itself, can you update your question with your TSLint config? Please also include an example of how TSLint is executed. – Matt R. Wilson Oct 03 '19 at 12:07
  • I'm unable to reproduce the issue using that config. Can you specify which version of TSLint you're using. At the same time, it Nock doesn't need to publishing it's tslint.json. I'll open a PR to remove it. – Matt R. Wilson Oct 15 '19 at 13:54
  • I'm using TSLint version 5.19.0. Nock is trying to extend dtslint json which is not present. – Mahendra R Oct 16 '19 at 10:03
  • The issue is that tslint is using a tslint.json file inside of node_modules. Since I haven't heard of this issue from others, I have to assume it's something to do with your config. – Matt R. Wilson Oct 16 '19 at 15:52
  • This might help: https://github.com/palantir/tslint/issues/3430 – A Jar of Clay Jan 22 '20 at 10:35

1 Answers1

1

When I had this issue, it was fixed by running: npm install --save dtslint

A Jar of Clay
  • 5,622
  • 6
  • 25
  • 39