3
votes

I made a change to a file for Definitely Typed, and when I created a pull request, it failed because of a formatting error. I'm assuming this is TsLint. I've never set it up before. How do I get it setup locally so I can catch these errors before committing using VSCode?

Currently I've installed TSLint Globally:

npm install -g tslint typescript

and I've installed the TSLint extension... but I don't see any errors show up when I save my file. Do I need to tell it to start working?

I'm new to VSCode and TSLint and Node, so the more specific, the better.

Update

I am seeing this error now:

vscode-tslint: Cannot read tslint configuration - 'Failed to load c:\Users\dlabar\Documents\GitHub\DefinitelyTyped\types\xrm\tslint.json: Invalid "extends" configuration value - could not require "dtslint/dt.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.'

2

2 Answers

1
votes

Apparently node 7+ is required: https://github.com/Microsoft/dtslint/issues/29

Upgraded and everything worked.

1
votes

I ran into a similar error message; but, in my case, it was due to not having installed a new dependency that tslint.json was referencing. Running yarn install (may be npm install for you) in the root of my project fixed the issue.