Skip to content

Commit

Permalink
🚨 Fixes for xo compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
vicalca committed Oct 21, 2019
1 parent 267e106 commit 54b23f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
""
],
"dependencies": {
"chalk": "^2.4.2",
"clipboardy": "^1.2.3",
"conf": "^2.1.0",
"env-paths": "^2.2.0",
Expand Down
18 changes: 8 additions & 10 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const envPaths = require('env-paths');

const paths = envPaths('standup-boy');
const fs = require('fs-extra');
const chalk = require('chalk');
const config = require('./config');
const template = require('./template');
const replace = require('./replace');
Expand Down Expand Up @@ -74,25 +73,23 @@ if (cli.flags.log) {
if (cli.flags.from) {
date = Date.parse(cli.flags.from);
if (isNaN(date)) {
throw Error("Invalid date format provided!");
throw new TypeError('Invalid date format provided!');
}
}

for (let i = 0; i < res.length; i++) {
printLog(res[i], date);
}
}
catch (error) {
} catch (error) {
console.error(error);
console.error("Error while retrieving the logs.")
console.error('Error while retrieving the logs.');
process.exit(-1);
}
process.exit(0);
}

function printLog(log, date) {
if(Date.parse(log.date) > date )
{
if (Date.parse(log.date) > date) {
console.log(log.date);
console.log(JSON.stringify(log.messages, null, 2));
console.log();
Expand Down Expand Up @@ -133,7 +130,7 @@ prompt.initialQuestions().then(
);

function saveToHistory(answers) {
let log = {};
const log = {};
log.date = new Date().toString();
log.messages = [answers.yesterday, answers.today, answers.obstacles];

Expand All @@ -142,10 +139,11 @@ function saveToHistory(answers) {

let newHistLogsText;
try {
var histLogs = JSON.parse(histLogsText);
const histLogs = JSON.parse(histLogsText);
histLogs.push(log);
newHistLogsText = JSON.stringify(histLogs);
} catch {
} catch (error) {
// Ignoring error
newHistLogsText = JSON.stringify([log]);
}

Expand Down

0 comments on commit 54b23f7

Please sign in to comment.