Skip to content
This repository has been archived by the owner on Mar 29, 2021. It is now read-only.

Commit

Permalink
ExtraArgs, Project, TypeCheck, and Version (beta1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Goldberg committed Oct 20, 2016
1 parent 29c8191 commit 6964123
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 12 deletions.
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ Read the [TSLint documentation](https://github.com/palantir/tslint) for TSLint-s
<tr>
<th><code>TSLintExclude</code></th>
<td>Globs of file names to exclude.</td>
<td><em>(blank)</em></td>
<td><em><code>(blank)</code></em></td>
</tr>
<tr>
<th><code>TSLintRulesDirectory</code></th>
<td>Directories for user-created rules</td>
<td><em>(blank)</em></td>
<td><em><code>(blank)</code></em></td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -69,7 +69,7 @@ Note that to use special characters (such as `*` wildcards) in `TSLintExclude` y
<tr>
<th><code>TSLintConfig</code></th>
<td>Path to a specific tslint.json.</td>
<td><em>(blank)</em></td>
<td><em><code>(blank)</code></em></td>
</tr>
<tr>
<th><code>TSLintCli</code></th>
Expand All @@ -81,15 +81,35 @@ Note that to use special characters (such as `*` wildcards) in `TSLintExclude` y
<td>Whether to skip running TSLint.</td>
<td><code>false</code></td>
</tr>
<tr>
<th><code>TSLintExtraArgs</code></th>
<td>Any extra arguments to pass to the TSLint CLI.</td>
<td><code>(blank)</code></td>
</tr>
<tr>
<th><code>TSLintNodeExe</code></th>
<td>Path to a Node executable to execute the runner script.</td>
<td>The <code>tools\node-6.1.0.exe</code> in the package.</td>
</tr>
<tr>
<th><code>TSLintProject</code></th>
<td>Path to a <code>tsconfig.json</code> file to use as a type checker project.</td>
<td><em><code>(blank)</code></em></td>
</tr>
<tr>
<th><code>TSLintRunOutsideBuildingProject</code></th>
<td>Whether to run even if `BuildingProject` isn't `true`.</td>
<td><em>(blank)</em></td>
<td><em><code>(blank)</code></em></td>
</tr>
<tr>
<th><code>TSLintTypeCheck</code></th>
<td>Whether to enable the type checker (requires <code>TSLintProject</code> be set).</td>
<td><code>false</code></td>
</tr>
<tr>
<th><code>TSLintVersion</code></th>
<td>Glob filter for the version of TSLint to use <em>(ignored if <code>TSLintConfig</code> is provided)</em>.</td>
<td><code>*.*.*</code></td>
</tr>
</tbody>
</table>
Expand Down
2 changes: 1 addition & 1 deletion TSLint.MSBuild.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>TSLint.MSBuild</id>
<title>TSLint.MSBuild</title>
<version>1.0.0-beta0</version>
<version>1.0.0-beta1</version>
<authors>palantir, joshuakgoldberg</authors>
<owners>joshuakgoldberg</owners>
<licenseUrl>https://github.com/JoshuaKGoldberg/TSLint.MSBuild/blob/master/LICENSE.md</licenseUrl>
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const request = require("request");
const runSequence = require("run-sequence");
const msbuild = require("gulp-msbuild");

const tests = ["TSLintArgs", "TSLintCli", "TSLintOutput"];
const tests = ["TSLintArgs", "TSLintCli", "TSLintOutput", "TSLintVersion"];
const testTasks = tests.map(testName => `test:${testName}`);

tests.forEach(testName => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tslint-msbuild",
"version": "1.0.0-beta0",
"version": "1.0.0-beta1",
"description": "An MSBuild target for linting TypeScript code using TSLint.",
"author": "Joshua K Goldberg",
"license": "MIT",
Expand Down
10 changes: 6 additions & 4 deletions src/build/TSLint.MSBuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
<!-- PropertyGroup settings -->
<PropertyGroup>
<TSLintBreakBuildOnError Condition="'$(TSLintBreakBuildOnError)' == ''">false</TSLintBreakBuildOnError>
<TSLintConfig Condition="'$(TSLintConfig)' == ''"></TSLintConfig>
<TSLintErrorSeverity Condition="'$(TSLintErrorSeverity)' == ''"></TSLintErrorSeverity>
<TSLintNodeExe Condition="'$(TSLintNodeExe)' == ''">$([System.IO.Path]::GetFullPath("$(MSBuildThisFileDirectory)..\tools\node-6.1.0.exe"))</TSLintNodeExe>
<TSLintVersion Condition="'$(TSLintVersion)' == ''">*.*.*</TSLintVersion>
</PropertyGroup>

<!-- Grab the first matching TSLint CLI in a NuGet packages install -->
<ItemGroup Condition="'$(TSLintCli)' == ''">
<TSLintPotentialCli Include="$(SolutionDir)packages\tslint.*.*.*\tools\node_modules\tslint\lib\tslint-cli.js" />
<TSLintPotentialCli Include="$(MSBuildThisFileDirectory)..\..\tslint.*.*.*\tools\node_modules\tslint\lib\tslint-cli.js" />
<TSLintPotentialCli Include="$(SolutionDir)packages\tslint.$(TSLintVersion)\tools\node_modules\tslint\lib\tslint-cli.js" />
<TSLintPotentialCli Include="$(MSBuildThisFileDirectory)..\..\tslint.$(TSLintVersion)\tools\node_modules\tslint\lib\tslint-cli.js" />
</ItemGroup>
<PropertyGroup Condition="'$(TSLintCli)' == ''">
<TSLintCliProperty>@(TSLintPotentialCli);</TSLintCliProperty>
Expand All @@ -40,7 +39,10 @@
<TSLintArgs Condition="'$(TSLintConfig)' != ''">$(TSLintArgs) --config $(TSLintConfig)</TSLintArgs>
<TSLintArgs Condition="'@(TSLintExclude)' != ''">$(TSLintArgs) --exclude $(TSLintExcludeJoined)</TSLintArgs>
<TSLintArgs>$(TSLintArgs) --format msbuild</TSLintArgs>
<TSLintArgs Condition="'$(TSLintProject)' != ''">$(TSLintArgs) --project $(TSLintProject)</TSLintArgs>
<TSLintArgs Condition="'$(TSLintTypeCheck)' != ''">$(TSLintArgs) --type-check $(TSLintTypeCheck)</TSLintArgs>
<TSLintArgs Condition="'@(TSLintRulesDirectory)' != ''">$(TSLintArgs) --rules-dir @(TSLintRulesDirectory, ' --rules-dir ')</TSLintArgs>
<TSLintArgs Condition="'$(TSLintExtraArgs)' != ''">$(TSLintArgs) $(TSLintExtraArgs)</TSLintArgs>
<TSLintArgs Condition="'@(TypeScriptCompile)' != ''">$(TSLintArgs) @(TypeScriptCompile, ' ')</TSLintArgs>
</PropertyGroup>

Expand Down
5 changes: 4 additions & 1 deletion test/TSLintArgs/TSLintArgs/TSLintArgs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@
<PropertyGroup>
<TSLintDisabled>true</TSLintDisabled>
<TSLintConfig>tslint.json</TSLintConfig>
<TSLintExtraArgs>--baz qux</TSLintExtraArgs>
<TSLintProject>tsconfig.json</TSLintProject>
<TSLintTypeCheck>true</TSLintTypeCheck>
</PropertyGroup>

<!-- Post-TSLint verification -->
<Target AfterTargets="TSLint" Name="Test">
<PropertyGroup>
<TSLintArgsExpected> --config tslint.json --exclude foo.ts --exclude bar.ts --format msbuild --rules-dir rules/foo --rules-dir rules/bar foo.ts bar.ts baz.ts qux.ts</TSLintArgsExpected>
<TSLintArgsExpected> --config tslint.json --exclude foo.ts --exclude bar.ts --format msbuild --project tsconfig.json --type-check true --rules-dir rules/foo --rules-dir rules/bar --baz qux foo.ts bar.ts baz.ts qux.ts</TSLintArgsExpected>
</PropertyGroup>

<Error
Expand Down
13 changes: 13 additions & 0 deletions test/TSLintVersion/TSLintVersion.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Microsoft Visual Studio Solution File, Format Version 12.00

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TSLintVersion", "TSLintVersion/TSLintVersion.csproj", "{TSLintVersion-Guid}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{TSLintVersion-Guid}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{TSLintVersion-Guid}.Debug|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
EndGlobal
39 changes: 39 additions & 0 deletions test/TSLintVersion/TSlintVersion/TSLintVersion.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\src\build\TSLint.MSBuild.targets" />

<Target Name="Rebuild" />

<!-- Fake setup for the TypeScript build environment -->
<Target AfterTargets="Rebuild" Name="CompileTypeScript">
<ItemGroup>
<TypeScriptCompile Include="foo.ts" />
</ItemGroup>

<PropertyGroup>
<BuildingProject>true</BuildingProject>
</PropertyGroup>
</Target>

<!-- Fake properties for the TSLint task -->
<PropertyGroup>
<TSLintDisabled>true</TSLintDisabled>
<TSLintVersion>1.1?.2</TSLintVersion>
</PropertyGroup>

<!-- Post-TSLint verification -->
<Target AfterTargets="TSLint" Name="Test">
<PropertyGroup>
<TSLintCliExpected>$(SolutionDir)packages\tslint.1.12.2\tools\node_modules\tslint\lib\tslint-cli.js</TSLintCliExpected>
</PropertyGroup>

<Error
Condition="'$(TSLintCliExpected)' != '$(TSLintCli)'"
Text="Expected TSLintCli to be%0a'$(TSLintCliExpected)'%0abut got%0a'$(TSLintCli)'.." />

<Message
Condition="'$(TSLintCliExpected)' == '$(TSLintCli)'"
Importance="High"
Text="TSLintCli passed." />
</Target>
</Project>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6964123

Please sign in to comment.