TSLint for MSBuild
Add this package and TSLint using your NuGet Package Manager. It should be automatically added to your project.
TSLint's default configurations are used by default.
If you'd like to use your own
tslint.json file, add a
TSLintConfig property to your project:
All overrideable item groups and properties are below. Read the TSLint documentation for TSLint-specific linting details.
Overrideable Item Groups
||Globs of file names to exclude.||
||Directories for user-created rules||
Note that to use special characters (such as
* wildcards) in
TSLintExclude you must escape the special characters.
<!-- Equivalent to "typings/**/*.d.ts" --> <TSLintExclude Include="typings/%2A%2A/%2A.d.ts" />
||Whether linting failures should break the build.||
||Path to a specific tslint.json.||
||Path to a TSLint CLI to run with.||The first TSLint version in the solution's
||Whether to skip running TSLint.||
||Any extra arguments to pass to the TSLint CLI.||
||Path to a Node executable to execute the runner script.||The
||Path to a
||Whether to run even if `BuildingProject` isn't `true`.||
||Maximum time to run the task, in case TSLint hangs or takes too long.||
||Whether to enable the type checker (requires
||Glob filter for the version of TSLint to use (ignored if
||Whether to disable passing TypeScript file list on the command line. If true, it is expected that the files to lint are specified in the
Output Item Groups
||Lines of console output from the TSLint CLI.|
||Exit code of the TSLint CLI.|
The first available TSLint version in your NuGet packages directory will be used.
You can exclude
.d.ts files using
<TSLintExclude Include="%2A%2A/%2A.d.ts" />.
* and other special characters using
% and their hexadecimal value.
Run the following commands to initialize your environment:
gulp to build.
gulp test just runs tests.
Updating the version
The version number is stored both in
Make sure to update it in both places.
0.X to 1.X
1.X versions now are completely in a single MSBuild file. This is better for performance but has two downsides:
- It no longer searches for the "highest" available TSLint version in the packages directory; instead, the first found in a file search is used.
TSLintErrorSeverityflag is no longer supported (until TSLint adds support for error levels).
1.0.0 removed the TSLint NuGet package dependency.
You'll need to install it separately.
The original structure of TSLint.MSBuild requires multiple layers of processes calling each other, which can wreak havoc in complex managed build systems. Then, in order:
1.X unified all the logic into MSBuild, which resulted in significant performance gains, code simplification, and runtime stability. Now, in order:
- MSBuild determines build settings and TSLint location
- MSBuild runs TSLint using the packaged Node executable
0.3.X to 0.4.X
Versions 0.3.X and below manually call TSLint on individual folders, whereas 0.4.X defers to the TSLint CLI.
File a bug report if upgrading causes any issues.