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

@@ -7,10 +7,17 @@ let curBranch = 'master';
let direction = 'LR';
let seq = 0;
/**
*
*/
function getId() {
return random({ length: 7 });
}
/**
* @param currentCommit
* @param otherCommit
*/
function isfastforwardable(currentCommit, otherCommit) {
log.debug('Entering isfastforwardable:', currentCommit.id, otherCommit.id);
while (currentCommit.seq <= otherCommit.seq && currentCommit !== otherCommit) {
@@ -30,6 +37,10 @@ function isfastforwardable(currentCommit, otherCommit) {
return currentCommit.id === otherCommit.id;
}
/**
* @param currentCommit
* @param otherCommit
*/
function isReachableFrom(currentCommit, otherCommit) {
const currentSeq = currentCommit.seq;
const otherSeq = otherCommit.seq;
@@ -37,6 +48,10 @@ function isReachableFrom(currentCommit, otherCommit) {
return false;
}
/**
* @param list
* @param fn
*/
function uniqBy(list, fn) {
const recordMap = Object.create(null);
return list.reduce((out, item) => {
@@ -138,6 +153,11 @@ export const reset = function (commitRef) {
branches[curBranch] = commit.id;
};
/**
* @param arr
* @param key
* @param newval
*/
function upsert(arr, key, newval) {
const index = arr.indexOf(key);
if (index === -1) {
@@ -147,6 +167,9 @@ function upsert(arr, key, newval) {
}
}
/**
* @param commitArr
*/
function prettyPrintCommitHistory(commitArr) {
const commit = commitArr.reduce((out, commit) => {
if (out.seq > commit.seq) return out;

View File

@@ -30,6 +30,9 @@ export const setConf = function (c) {
apiConfig = c;
};
/**
* @param svg
*/
function svgCreateDefs(svg) {
svg
.append('defs')
@@ -52,6 +55,12 @@ function svgCreateDefs(svg) {
.html('');
}
/**
* @param svg
* @param points
* @param colorIdx
* @param interpolate
*/
function svgDrawLine(svg, points, colorIdx, interpolate) {
const curve = interpolateToCurve(interpolate, curveBasis);
const color = config.branchColors[colorIdx % config.branchColors.length];
@@ -72,7 +81,12 @@ function svgDrawLine(svg, points, colorIdx, interpolate) {
.style('fill', 'none');
}
// Pass in the element and its pre-transform coords
/**
* Pass in the element and its pre-transform coords
*
* @param element
* @param coords
*/
function getElementCoords(element, coords) {
coords = coords || element.node().getBBox();
const ctm = element.node().getCTM();
@@ -86,6 +100,13 @@ function getElementCoords(element, coords) {
};
}
/**
* @param svg
* @param fromId
* @param toId
* @param direction
* @param color
*/
function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
log.debug('svgDrawLineForCommits: ', fromId, toId);
const fromBbox = getElementCoords(svg.select('#node-' + fromId + ' circle'));
@@ -190,10 +211,20 @@ function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
}
}
/**
* @param svg
* @param selector
*/
function cloneNode(svg, selector) {
return svg.select(selector).node().cloneNode(true);
}
/**
* @param svg
* @param commitid
* @param branches
* @param direction
*/
function renderCommitHistory(svg, commitid, branches, direction) {
let commit;
const numCommits = Object.keys(allCommitsDict).length;
@@ -276,6 +307,12 @@ function renderCommitHistory(svg, commitid, branches, direction) {
}
}
/**
* @param svg
* @param commit
* @param direction
* @param branchColor
*/
function renderLines(svg, commit, direction, branchColor) {
branchColor = branchColor || 0;
while (commit.seq > 0 && !commit.lineDrawn) {