Are there any good tools for static code analysis in typescript?

Mathias Falkenberg picture Mathias Falkenberg · Nov 24, 2014 · Viewed 9.8k times · Source

We have been searching for good tools for measuring the quality of our TypeScript code. Mainly, we are interested in measuring Cyclomatic Complexity, LCOM, Instability and similar metrics. A tool for visualizing dependencies between modules would also be nice.

A sort of "NDepend for typescript" would be great - but we haven't been able to find anything like it...

Can anyone point us in the direction of any tools that provide some such functionality?

Answer

basarat picture basarat · Nov 24, 2014

We have been searching for good tools for measuring the quality of our TypeScript code

Similar to JSHint (mentioned by Steve) for TypeScript there is TSLint https://github.com/palantir/tslint (with a grunt plugin https://github.com/palantir/grunt-tslint)

The roles aren't that complex to create yourself based on TypeScript language service ASTWalker mechanism e.g. Indent rule : https://github.com/palantir/tslint/blob/master/src/rules/indentRule.ts