enable eslint fix and eslint-plugin-jsdoc

This commit is contained in:
Matthieu MOREL
2021-11-08 22:06:24 +01:00
committed by Matthieu Morel
parent c29c8bd33c
commit 4d103c14f7
53 changed files with 3476 additions and 2715 deletions

View File

@@ -71,6 +71,10 @@ export const draw = function (text, id) {
categories = checkUnique(categories);
/**
* @param a
* @param b
*/
function taskCompare(a, b) {
const taskA = a.startTime;
const taskB = b.startTime;
@@ -98,6 +102,11 @@ export const draw = function (text, id) {
.attr('y', conf.titleTopMargin)
.attr('class', 'titleText');
/**
* @param tasks
* @param pageWidth
* @param pageHeight
*/
function makeGant(tasks, pageWidth, pageHeight) {
const barHeight = conf.barHeight;
const gap = barHeight + conf.barGap;
@@ -125,6 +134,15 @@ export const draw = function (text, id) {
drawToday(leftPadding, topPadding, pageWidth, pageHeight);
}
/**
* @param theArray
* @param theGap
* @param theTopPad
* @param theSidePad
* @param theBarHeight
* @param theColorScale
* @param w
*/
function drawRects(theArray, theGap, theTopPad, theSidePad, theBarHeight, theColorScale, w) {
// Draw background rects covering the entire width of the graph, these form the section rows.
svg
@@ -352,6 +370,16 @@ export const draw = function (text, id) {
}
});
}
/**
* @param theGap
* @param theTopPad
* @param theSidePad
* @param w
* @param h
* @param tasks
* @param excludes
* @param includes
*/
function drawExcludeDays(theGap, theTopPad, theSidePad, w, h, tasks, excludes, includes) {
const minTime = tasks.reduce(
(min, { startTime }) => (min ? Math.min(min, startTime) : startTime),
@@ -414,6 +442,12 @@ export const draw = function (text, id) {
.attr('class', 'exclude-range');
}
/**
* @param theSidePad
* @param theTopPad
* @param w
* @param h
*/
function makeGrid(theSidePad, theTopPad, w, h) {
let bottomXAxis = axisBottom(timeScale)
.tickSize(-h + theTopPad + conf.gridLineStartPadding)
@@ -450,6 +484,10 @@ export const draw = function (text, id) {
}
}
/**
* @param theGap
* @param theTopPad
*/
function vertLabels(theGap, theTopPad) {
const numOccurances = [];
let prevGap = 0;
@@ -503,6 +541,12 @@ export const draw = function (text, id) {
});
}
/**
* @param theSidePad
* @param theTopPad
* @param w
* @param h
*/
function drawToday(theSidePad, theTopPad, w, h) {
const todayMarker = ganttDb.getTodayMarker();
if (todayMarker === 'off') {
@@ -525,7 +569,11 @@ export const draw = function (text, id) {
}
}
// from this stackexchange question: http://stackoverflow.com/questions/1890203/unique-for-arrays-in-javascript
/**
* from this stackexchange question: http://stackoverflow.com/questions/1890203/unique-for-arrays-in-javascript
*
* @param arr
*/
function checkUnique(arr) {
const hash = {};
const result = [];
@@ -540,7 +588,11 @@ export const draw = function (text, id) {
return result;
}
// from this stackexchange question: http://stackoverflow.com/questions/14227981/count-how-many-strings-in-an-array-have-duplicates-in-the-same-array
/**
*from this stackexchange question: http://stackoverflow.com/questions/14227981/count-how-many-strings-in-an-array-have-duplicates-in-the-same-array
*
* @param arr
*/
function getCounts(arr) {
let i = arr.length; // const to loop over
const obj = {}; // obj to store results
@@ -550,7 +602,12 @@ export const draw = function (text, id) {
return obj;
}
// get specific from everything
/**
* get specific from everything
*
* @param word
* @param arr
*/
function getCount(word, arr) {
return getCounts(arr)[word] || 0;
}