Skip to content

Commit

Permalink
Merge pull request #18 from yuezk/bugfix
Browse files Browse the repository at this point in the history
Fix eslint module not found error
  • Loading branch information
mantoni committed Nov 20, 2015
2 parents 8725c74 + 69b21f0 commit 6bba3bf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ module.exports = function (cwd, args, text) {
process.chdir(cwd);
var cwdEslint = eslintMap[cwd];
if (!cwdEslint) {
var cwdPath = resolve.sync('eslint', { basedir: cwd });
var cwdPath;
// resolve will throw an error, if module not found
try {
cwdPath = resolve.sync('eslint', { basedir: cwd });
} catch (e) {
// module not found
}
cwdEslint = cwdPath ? require(cwdPath) : require('eslint');
eslintMap[cwd] = cwdEslint;
}
Expand Down

0 comments on commit 6bba3bf

Please sign in to comment.