JoshuaKGoldberg / TSLint.MSBuild

[Deprecated] An MSBuild task for running TSLint.
https://www.nuget.org/packages/TSLint.MSBuild
MIT License
15 stars 13 forks source link

Does not work on large projects #71

Closed brettjacobson closed 7 years ago

brettjacobson commented 7 years ago

One of our projects has a ton of typescript files. When we add this nuget package and try and get it to work, it does not work. It just says `The system cannot execute the specified program", and "The command {yadda yadda yadda} exited with code 9020." (this is from a build server log in TFS, because we don't even get that much information locally).

I'm fairly certain the problem is that the command line is too long. In the log file, its 48000 characters in length, and I believe the max is 8000.

TSlint works in the SonarQube step in our build, and I've seen that SonarTS plugin breaks the tslint execution into 'batches' presumably to avoid the max command line length problem.

Do you know of any solutions?

TSLint supports specifying the files to lint via a tsconfig.json file, is that an alternative?

brettjacobson commented 7 years ago

I think I could utilize $(TSLintProject) and specify a tsconfig.json file which --project would pick up to find the "files" element to know which ts files to lint; however, @(TypeScriptCompile) would still emit all TS files in the Visual Studio project file, thus blowing up the max command line length. Would need a conditional that said to NOT specify all the files on the command line?

JoshuaKGoldberg commented 7 years ago

The "limit" I've experienced in other MSBuild contexts for Exec is 8192 characters, in that it deletes every 8192nd character in the Command option. It's pretty ridiculous.

Having a flag to not include the list of files manually would be great.

brettjacobson commented 7 years ago

<TSLintArgs Condition="'$(TSLintFileListDisabled)' != 'true' And '@(TypeScriptCompile)' != ''">$(TSLintArgs) @(TypeScriptCompile, ' ')</TSLintArgs>

Works for me so far; I'll write tests and submit a PR tomorrow.

How could we make it throw an error if TSLintFileListDisabled is true, but TSLintProject was blank?

JoshuaKGoldberg commented 7 years ago

The Condition property of the Error field should be able to do it.

brettjacobson commented 7 years ago

Is there a way to make a test for the Error scenario?

JoshuaKGoldberg commented 7 years ago

Ehh, I can't think of one. Looks like we'll have to go without!