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 an error saying, "failed to load tslint", but you have tslint installed locally,
try to install tslint and its typescript dependency globally using
npm install -g tslint typescript.
Notice this configuration settings allow you to configure the behaviour of the vscode-tslint extension. To configure rules and tslint options you should use the
tslint.enable - enable/disable tslint.
tslint.jsEnable - enable/disable tslint for .js files, default is
tslint.run - run the linter
onType, default is
tslint.rulesDirectory - an additional rules directory, for user-created rules.
tslint.configFile - the configuration file that tslint should use instead of the default
tslint.ignoreDefinitionFiles - control if TypeScript definition files should be ignored.
tslint.exclude - configure glob patterns of file paths to exclude from linting. The pattern is matched against the absolute path of the linted file.
tslint.validateWithDefaultConfig - validate a file for which no custom tslint configuration was found. The default is
tslint.nodePath - custom path to node modules directory, used to load tslint from a different location than the default of the current workspace or the global node modules directory.
tslint.autoFixOnSave - fix auto-fixable warnings when a file is saved. Note: Auto-fixing is only done when manually saving a file. It is not performed when the file is automatically saved based on the
files.autoSave setting. Executing a manual save on an already-saved document will trigger auto-fixing.
tslint.alwaysShowRuleFailuresAsWarnings - always show rule failures as warnings, ignoring the severity configuration in the
The extension supports automatic fixing of warnings to the extent supported by tslint. For warnings which support an auto-fix, a light bulb is shown when the cursor is positioned inside the warning's range. You can apply the quick fix by either:
- clicking the light bulb appearing or by executing the
Quick Fix, when the mouse is over the erroneous code
- or using the command
Fix all auto-fixable problems.
When there are overlapping auto fixes a user will have to trigger
Fix all auto-fixable problems more than once.
ProblemPatterns and ProblemMatchers
The extension contributes a
tslint4 and a
ProblemMatcher and corresponding problem patterns. You can use these variables when defining a tslint task in your
task.json file. The
tslint5 problem matcher matches the rule severities introduced in version 5 of tslint.