How to lint for Typescript compilation issues? : <p>Take the following Typescript arrow function:</p>

<pre><code>/**
 * Returns a probably unique component name.
 * 
 * @param baseName a suggested name to make unique.
 * @returns a probably unique name.
 */
export const getUniqueComponentName = (
  baseName
): string =&gt; {
  return baseName + Math.round(Math.random() * 10000000)
}
</code></pre>

<p>When Typescript is configured in <code>tsconfig.json</code> as such:</p>

<pre><code>"noImplicitAny": true,
</code></pre>

<p>This correctly results in a compilation error:</p>

<blockquote>
  <p>[ts] Parameter 'baseName' implicitly has an 'any' type.</p>
</blockquote>

<p>Visual Studio Code is also smart enough to inform you about this issue during development.</p>

<p>My goal is to create a precommit git hook that prevents such errors from ending up in version control. I tried to do this with <code>tslint</code>, <code>husky</code> and <code>lint-staged</code> using this <code>npm script</code>:</p>

<pre><code>"lint": "tslint --project tsconfig.json --config tslint.json"
</code></pre>

<p>However, this does not result in the compilation error showing up by tslint. It is silently ignored.</p>

<p>I then tried to add a rule in tslint.json:</p>

<pre><code>"typedef": [
      true,
      "arrow-parameter"
    ]
</code></pre>

<p>While this did make tslint complain, it also started to complain in anonymous arrow functions where the <code>tsc</code> compiler does not complain. In these arrow functions it should not be necessary to add types because the types were already set previously in the parent scope (they are inferred). </p>

<p>So basically, I would like for tslint to behave the same as tsc in this case. Anytime there is an error that would cause compilation to fail (such as the above arrow function), I would like to prevent the commit, but without actually compiling to Javascript. Is this possible?</p>
