> In theory, the afterLinting() could be called as soon as the first file is done, causing the pending to decrement and thus we're done.

if linting has completed (or there were never any js files at all) but the scanner has not yet emitted a 'done' event, pending will be === 1. see my replies to your other comments about initializing pending to 1.

perhaps it would be more clear for this case if scanfs emitted a "start" event, and I incremented pending there, but functionally is same.