Commit 45a446ea authored by Mike Greiling's avatar Mike Greiling

resolve comma-dangle and object-shorthand eslint violations

parent 69021457
/* eslint-disable no-var, vars-on-top, object-shorthand, comma-dangle, eqeqeq, no-mixed-operators, no-return-assign, newline-per-chained-call, prefer-arrow-callback, consistent-return, one-var, one-var-declaration-per-line, prefer-template, quotes, no-unused-vars, no-else-return, max-len, class-methods-use-this */ /* eslint-disable no-var, vars-on-top, eqeqeq, no-mixed-operators, no-return-assign, newline-per-chained-call, prefer-arrow-callback, consistent-return, one-var, one-var-declaration-per-line, prefer-template, quotes, no-unused-vars, no-else-return, max-len, class-methods-use-this */
import d3 from 'd3'; import d3 from 'd3';
...@@ -18,6 +18,7 @@ export default class ActivityCalendar { ...@@ -18,6 +18,7 @@ export default class ActivityCalendar {
this.daySizeWithSpace = this.daySize + (this.daySpace * 2); this.daySizeWithSpace = this.daySize + (this.daySpace * 2);
this.monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; this.monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
this.months = []; this.months = [];
// Loop through the timestamps to create a group of objects // Loop through the timestamps to create a group of objects
// The group of objects will be grouped based on the day of the week they are // The group of objects will be grouped based on the day of the week they are
this.timestampsTmp = []; this.timestampsTmp = [];
...@@ -36,7 +37,7 @@ export default class ActivityCalendar { ...@@ -36,7 +37,7 @@ export default class ActivityCalendar {
date.setDate(date.getDate() + i); date.setDate(date.getDate() + i);
var day = date.getDay(); var day = date.getDay();
var count = timestamps[date.format('yyyy-mm-dd')]; var count = timestamps[date.format('yyyy-mm-dd')] || 0;
// Create a new group array if this is the first day of the week // Create a new group array if this is the first day of the week
// or if is first object // or if is first object
...@@ -45,13 +46,9 @@ export default class ActivityCalendar { ...@@ -45,13 +46,9 @@ export default class ActivityCalendar {
group += 1; group += 1;
} }
var innerArray = this.timestampsTmp[group - 1];
// Push to the inner array the values that will be used to render map // Push to the inner array the values that will be used to render map
innerArray.push({ var innerArray = this.timestampsTmp[group - 1];
count: count || 0, innerArray.push({ count, date, day });
date: date,
day: day
});
} }
// Init color functions // Init color functions
...@@ -97,15 +94,9 @@ export default class ActivityCalendar { ...@@ -97,15 +94,9 @@ export default class ActivityCalendar {
lastMonthX = lastMonth.x; lastMonthX = lastMonth.x;
} }
if (lastMonth == null) { if (lastMonth == null) {
return this.months.push({ return this.months.push({ month, x });
month: month,
x: x
});
} else if (month !== lastMonth.month && x - this.daySizeWithSpace !== lastMonthX) { } else if (month !== lastMonth.month && x - this.daySizeWithSpace !== lastMonthX) {
return this.months.push({ return this.months.push({ month, x });
month: month,
x: x
});
} }
} }
}); });
...@@ -144,14 +135,14 @@ export default class ActivityCalendar { ...@@ -144,14 +135,14 @@ export default class ActivityCalendar {
const days = [ const days = [
{ {
text: 'M', text: 'M',
y: 29 + (this.daySizeWithSpace * 1) y: 29 + (this.daySizeWithSpace * 1),
}, { }, {
text: 'W', text: 'W',
y: 29 + (this.daySizeWithSpace * 3) y: 29 + (this.daySizeWithSpace * 3),
}, { }, {
text: 'F', text: 'F',
y: 29 + (this.daySizeWithSpace * 5) y: 29 + (this.daySizeWithSpace * 5),
} },
]; ];
this.svg.append('g') this.svg.append('g')
.selectAll('text') .selectAll('text')
...@@ -227,8 +218,6 @@ export default class ActivityCalendar { ...@@ -227,8 +218,6 @@ export default class ActivityCalendar {
} }
initTooltips() { initTooltips() {
return $('.js-contrib-calendar .js-tooltip').tooltip({ $('.js-contrib-calendar .js-tooltip').tooltip({ html: true });
html: true
});
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment