Integrates the tslint linter for the TypeScript language into VS Code.
Please refer to the tslint documentation for how to configure the linting rules.
The extension requires that tslint is installed either locally or globally.
Tip: if you get the error that "failed to load tslint", but you have tslint installed locally, then try to install tslint and its typescript dependency globally using
npm install -g tslint typescript
.
The recommended version of tslint is 3.2.1.
tslint.enable
- enable/disable tslint.tslint.rulesDirectory
- an additional rules directory, for user-created rules.tslint.configFile
- the configuration file that tslint should use instead of the defaulttslint.json
.tslint.ignoreDefinitionFiles
- control if TypeScript definition files should be ignored.tslint.exclude
- configure glob patterns of file paths to exclude from linting.tslint.validateWithDefaultConfig
- validate a file for which there was no custom tslint confguration found. The default isfalse
.
The extension supports some quick fixing of warnings. For warnings which support a quick fix a light bulp is shown when the cursor is positioned inside the warning's range. You can apply the quick fix by either clicking the light bulp or by executing the Quick Fix
command. The following quick fixes are currently supported:
- missing whitespace
- missing semicolon
- missing trailing comma
- ' should be "
- " sould be '
- trailing whitespace
- file should end with a newline
- forbidden 'var' keyword
- Only prompt for installing tslint, when the workspace root includes a
tslint.json
file.
- Clear errors when document is closed.
- More quick fixes.
- Add support for quick fixing some warnings.
- Updated to version 2.0 of the vscode language protocol.
- Added the setting
tslint.validateWithDefaultConfig
.
- Added setting
tslint.validateWithDefaultConfig
. - Added setting
tslint.ignoreDefinitionFiles
.
- Watch for changes in the tslint.json when the file is located outside of the workspace.
- Handle the case where a user edits a
tslint.json
configuration file and it is in an intermediate inconsistent state gracefully.
- protect against exceptions thrown by tslint.
tslint.json
is now validated using a JSON schema.- Diagnostic messages produced by tslint are now tagged with
tslint
.
- Added the
tslint.configFile
option.