palantir/grunt-tslint — pull request #8 by Bartvds (2014-02-21 15:54:54+00:00)
Title: main loop async for 'streaming' output

When linting large projects the grunt task can seems to hang as the linting loop is fully synchronous and node would buffer the output (at least on windows it does)

This PR changes the loop to use async() and adds a 1ms timeout, this breaks up the node event-loop and allows it to flush output per file.

Of course I tried process.nextTick() instead of setTimeout, but it is not the 100% same behaviour, for example in WebStorm IDE (with grunt as External Tool) the view doesn't stream.

Overall processing time is still same, but it feels a lot smoother as the results come steaming in now.

- using async.reduce()
- setTimeout(f, 0) is to make sure output actually streams (tested in IntelliJ > Run Tools), as process.nextTick doesn't always flush buffer