thenlint
A lint for promises that checks for possible Promise.then
usage errors.
usage
From the command-line:
thenlint <file.js> [<other.js> ...]
As a library:
report = require('thenlint')(fileContent, filename)
.map(function(item) { return item.toString(); }).join('\n');
example errors
Suggests ending the promise chain with .done()
// no return or var/assignmentpromise; // no errback// no catch and no .done()
Missing return statement in the middle of a return chain:
promise;
non-errors
Adding catch instead of done is okay.
Not returning from within .then
is okay as long as we're not trying
to chain another .then
or .spread
// no return or assignmentpromise;
license
MIT