TSLint not working in VS Code

blankface picture blankface · Apr 12, 2018 · Viewed 26.9k times · Source

I added TSLint to my React/TypeScript project using the tslint VSCode extension. I also installed both typescript and tslint globally according to TSLint docs npm install -g tslint typescript

This is my tslint.json file:

{
  "extends": ["tslint:latest", "tslint-react"],
  "rules": {
    // override tslint-react rules here
    "jsx-wrap-multiline": false,
    "max-line-length": false,
    "no-implicit-dependencies": [true, "dev"],
    "no-var-requires": false,
    "indent": false
  }
}

Answer

ecraig12345 picture ecraig12345 · Apr 12, 2018

tslint-react is a tslint extension which has to be installed separately: npm install -g tslint-react. After installing, reload your VS Code window, and linting should work.


How I found the problem: I copied your config file into a project, went to View > Output to check for errors from the tslint process, and saw this. (be sure to select tslint from the dropdown near the top right)

Invalid "extends" configuration value - could not require "tslint-react"