TypeScript TSLint language service plugin
Перейти к файлу
Erich Gamma 451c20bb29 Update devDependency for TS 2017-05-01 15:26:15 +02:00
images Improve VS Code doc 2017-05-01 15:17:42 +02:00
scripts Add git-tag. 2017-03-25 17:22:21 +01:00
src Remove the no-unused-variables rules as a work around 2017-04-28 16:01:52 +02:00
test Fix test 2017-04-19 03:09:05 +02:00
.gitignore Rename .build to out 2017-04-06 17:29:47 +02:00
.npmignore Imrove installation guide + add demo 2017-04-20 14:11:15 +02:00
.travis.yml Use node LTS 2017-03-20 11:23:34 +00:00
LICENSE Initial commit 2017-01-11 19:23:50 +01:00
README.md Improve VS Code doc 2017-05-01 15:17:42 +02:00
package.json Update devDependency for TS 2017-05-01 15:26:15 +02:00
tsconfig.json Remove the no-unused-variables rules as a work around 2017-04-28 16:01:52 +02:00

README.md

tslint-language-service

Build Status NPM version

TypeScript language service plugin for tslint.

To use it the plugin:

  • install the plugin with npm install tslint-language-service

  • enable the plugin in your tsconfig.json file:

{
  "compilerOptions": {
    "plugins": [
      { "name": "tslint-language-service"}
    ]
  }
}
  • If you are using TypeScript < 2.2.1, you must execute tsserver with tsserver-plugins.

Your node_modules folder should look like this:

  • node_modules
    • tslint
    • tslint-language-service
    • typescript

Notice due to an issue in the implementation of the no-unused-variable rule ([issue15344]), this rule will be disabled by the plugin. You can use the typescript compiler options noUnusedLocals and noUnusedParameters instead.

Editors Support

All editors which consumes tsserver (VSCode, Sublime, Eclipse, etc) can use tslint-language-service. Here a demo with Eclipse and tslint 5.0.0

tslint demo

Eclipse

Install typescript.java and you can use the TypeScript Project wizard which configures tslint-language-service.

VSCode

Visual Studio code provides a vscode-tslint extension, to avoid that the a file is linted twice you should disable this extension.

The most important differences between the vscode-tslint extension and the tslint-languageservice-plugin are:

  • the plugin shares the program representation with TypeScript. This is more efficient than the vscode-tslint extension which needs to reanalyze the document. Since vscode-tslint lints one file a time only, it cannot support tslint rules that require the type checker. The language service plugin doesn't have this limitation.
  • vscode-tslint provides additional features, please file issue requests for the features you are missing.

To use the plugin with VS Code:

  • If you are using the vscode-tslint extension disable or uninstall it.
  • Install typescript, the tslint-language-service, and tslint into your workspace using npm install typescript tslint tslint-language-service.
  • Open VS Code on the workspace
  • Switch to the Typescript version that is installed locally in the workspace using the version switcher (see below) in the bottom right of the status bar.

ts version switcher

Demo

tslint demo VS Code