Skip to content

Commit

Permalink
Issue deployd#16 - fixed eslint issue | consistent-return rule
Browse files Browse the repository at this point in the history
  • Loading branch information
saloni.kathuria committed Oct 27, 2019
1 parent 04be13c commit 6bbf486
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions lib/cli/keygen.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const keygen = function () {
keys.create((err, key) => {
if (err) return console.error(err);
console.log('created key', `${key.substr(0, 16)}...`);
return true;
});
};

Expand Down
3 changes: 2 additions & 1 deletion lib/cli/showkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ const showkey = function () {
console.log();
console.log('dpd keygen');
console.log();
return;
return true;
}
console.log('Copy this key for use in remote dashboard');
console.log();
console.log(key);
console.log();
return true;
});
};

Expand Down
14 changes: 10 additions & 4 deletions lib/cli/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ const start = function (file) {
console.info('listening on port', options.port);
const commands = repl(dpd);
if (program.dashboard) {
commands.dashboard();
return commands.dashboard();
} else if (program.open) {
commands.open();
return commands.open();
}

return true;
}

function onError(err2) {
Expand All @@ -91,18 +93,22 @@ const start = function (file) {
dpd.on('error', onError);
dpd.listen();
} else {
process.exit();
return process.exit();
}
} else {
console.error(err2);
process.exit();
return process.exit();
}

return true;
}

dpd.on('listening', onListening);
dpd.on('error', onError);
dpd.listen();
dpd.deploydPath = program.deploydPath;

return true;
}


Expand Down
10 changes: 5 additions & 5 deletions lib/keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ Keys.prototype.create = function (fn) {
const fileData = data;

fileData[key] = true;
keys.writeFile(fileData, (errW) => {
fn(errW, key);
return keys.writeFile(fileData, (errW) => {
if (errW) return fn(errW);
return fn(errW, key);
});
});
};
Expand Down Expand Up @@ -95,9 +96,8 @@ Keys.prototype.getLocal = function (fn) {
this.readFile((err, data) => {
if (err) return fn(err);
if (data && typeof data === 'object') {
fn(null, Object.keys(data)[0]);
} else {
fn();
return fn(null, Object.keys(data)[0]);
}
return fn();
});
};

0 comments on commit 6bbf486

Please sign in to comment.