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

@@ -1,5 +1,10 @@
import dagreD3 from 'dagre-d3';
/**
* @param parent
* @param bbox
* @param node
*/
function question(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
@@ -17,6 +22,11 @@ function question(parent, bbox, node) {
return shapeSvg;
}
/**
* @param parent
* @param bbox
* @param node
*/
function hexagon(parent, bbox, node) {
const f = 4;
const h = bbox.height;
@@ -37,6 +47,11 @@ function hexagon(parent, bbox, node) {
return shapeSvg;
}
/**
* @param parent
* @param bbox
* @param node
*/
function rect_left_inv_arrow(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
@@ -54,6 +69,11 @@ function rect_left_inv_arrow(parent, bbox, node) {
return shapeSvg;
}
/**
* @param parent
* @param bbox
* @param node
*/
function lean_right(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
@@ -70,6 +90,11 @@ function lean_right(parent, bbox, node) {
return shapeSvg;
}
/**
* @param parent
* @param bbox
* @param node
*/
function lean_left(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
@@ -86,6 +111,11 @@ function lean_left(parent, bbox, node) {
return shapeSvg;
}
/**
* @param parent
* @param bbox
* @param node
*/
function trapezoid(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
@@ -102,6 +132,11 @@ function trapezoid(parent, bbox, node) {
return shapeSvg;
}
/**
* @param parent
* @param bbox
* @param node
*/
function inv_trapezoid(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
@@ -118,6 +153,11 @@ function inv_trapezoid(parent, bbox, node) {
return shapeSvg;
}
/**
* @param parent
* @param bbox
* @param node
*/
function rect_right_inv_arrow(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
@@ -135,6 +175,11 @@ function rect_right_inv_arrow(parent, bbox, node) {
return shapeSvg;
}
/**
* @param parent
* @param bbox
* @param node
*/
function stadium(parent, bbox, node) {
const h = bbox.height;
const w = bbox.width + h / 4;
@@ -154,6 +199,11 @@ function stadium(parent, bbox, node) {
return shapeSvg;
}
/**
* @param parent
* @param bbox
* @param node
*/
function subroutine(parent, bbox, node) {
const w = bbox.width;
const h = bbox.height;
@@ -176,6 +226,11 @@ function subroutine(parent, bbox, node) {
return shapeSvg;
}
/**
* @param parent
* @param bbox
* @param node
*/
function cylinder(parent, bbox, node) {
const w = bbox.width;
const rx = w / 2;
@@ -239,6 +294,9 @@ function cylinder(parent, bbox, node) {
return shapeSvg;
}
/**
* @param render
*/
export function addToRender(render) {
render.shapes().question = question;
render.shapes().hexagon = hexagon;
@@ -265,6 +323,9 @@ export function addToRender(render) {
render.shapes().rect_right_inv_arrow = rect_right_inv_arrow;
}
/**
* @param addShape
*/
export function addToRenderV2(addShape) {
addShape({ question });
addShape({ hexagon });
@@ -291,6 +352,12 @@ export function addToRenderV2(addShape) {
addShape({ rect_right_inv_arrow });
}
/**
* @param parent
* @param w
* @param h
* @param points
*/
function insertPolygonShape(parent, w, h, points) {
return parent
.insert('polygon', ':first-child')

View File

@@ -29,6 +29,7 @@ export const parseDirective = function (statement, context, type) {
/**
* Function to lookup domId from id in the graph definition.
*
* @param id
* @public
*/
@@ -44,11 +45,13 @@ export const lookUpDomId = function (id) {
/**
* Function called by parser when a node definition has been found
* @param id
*
* @param _id
* @param text
* @param type
* @param style
* @param classes
* @param dir
*/
export const addVertex = function (_id, text, type, style, classes, dir) {
let txt;
@@ -110,8 +113,9 @@ export const addVertex = function (_id, text, type, style, classes, dir) {
/**
* Function called by parser when a link/edge definition has been found
* @param start
* @param end
*
* @param _start
* @param _end
* @param type
* @param linktext
*/
@@ -152,8 +156,9 @@ export const addLink = function (_start, _end, type, linktext) {
/**
* Updates a link's line interpolation algorithm
* @param pos
* @param interpolate
*
* @param positions
* @param interp
*/
export const updateLinkInterpolate = function (positions, interp) {
positions.forEach(function (pos) {
@@ -167,7 +172,8 @@ export const updateLinkInterpolate = function (positions, interp) {
/**
* Updates a link with a style
* @param pos
*
* @param positions
* @param style
*/
export const updateLink = function (positions, style) {
@@ -204,6 +210,7 @@ export const addClass = function (id, style) {
/**
* Called by parser when a graph definition is found, stores the direction of the chart.
*
* @param dir
*/
export const setDirection = function (dir) {
@@ -224,6 +231,7 @@ export const setDirection = function (dir) {
/**
* Called by parser when a special node is found, e.g. a clickable element.
*
* @param ids Comma separated list of ids
* @param className Class to add
*/
@@ -298,8 +306,10 @@ const setClickFun = function (id, functionName, functionArgs) {
/**
* Called by parser when a link is found. Adds the URL to the vertex data.
*
* @param ids Comma separated list of ids
* @param linkStr URL to create a link for
* @param target
*/
export const setLink = function (ids, linkStr, target) {
ids.split(',').forEach(function (id) {
@@ -316,9 +326,10 @@ export const getTooltip = function (id) {
/**
* Called by parser when a click definition is found. Registers an event handler.
*
* @param ids Comma separated list of ids
* @param functionName Function to be called on click
* @param tooltip Tooltip for the clickable element
* @param functionArgs
*/
export const setClickEvent = function (ids, functionName, functionArgs) {
ids.split(',').forEach(function (id) {
@@ -337,6 +348,7 @@ export const getDirection = function () {
};
/**
* Retrieval function for fetching the found nodes after parsing has completed.
*
* @returns {{}|*|vertices}
*/
export const getVertices = function () {
@@ -345,6 +357,7 @@ export const getVertices = function () {
/**
* Retrieval function for fetching the found links after parsing has completed.
*
* @returns {{}|*|edges}
*/
export const getEdges = function () {
@@ -353,6 +366,7 @@ export const getEdges = function () {
/**
* Retrieval function for fetching the found class definitions after parsing has completed.
*
* @returns {{}|*|classes}
*/
export const getClasses = function () {
@@ -396,6 +410,8 @@ funs.push(setupToolTips);
/**
* Clears the internal graph db so that a new graph can be parsed.
*
* @param ver
*/
export const clear = function (ver) {
vertices = {};
@@ -423,6 +439,10 @@ export const defaultStyle = function () {
/**
* Clears the internal graph db so that a new graph can be parsed.
*
* @param _id
* @param list
* @param _title
*/
export const addSubGraph = function (_id, list, _title) {
// console.log('addSubGraph', _id, list, _title);
@@ -431,6 +451,9 @@ export const addSubGraph = function (_id, list, _title) {
if (_id === _title && _title.match(/\s/)) {
id = undefined;
}
/**
* @param a
*/
function uniq(a) {
const prims = { boolean: {}, number: {}, string: {} };
const objs = [];
@@ -701,6 +724,9 @@ const exists = (allSgs, _id) => {
};
/**
* Deletes an id from all subgraphs
*
* @param sg
* @param allSubgraphs
*/
const makeUniq = (sg, allSubgraphs) => {
const res = [];

View File

@@ -21,8 +21,10 @@ export const setConf = function (cnf) {
/**
* Function that adds the vertices found during parsing to the graph to be rendered.
*
* @param vert Object containing the vertices.
* @param g The graph that is to be drawn.
* @param svgId
*/
export const addVertices = function (vert, g, svgId) {
const svg = select(`[id="${svgId}"]`);
@@ -34,6 +36,7 @@ export const addVertices = function (vert, g, svgId) {
/**
* Variable for storing the classes for the vertex
*
* @type {string}
*/
let classStr = 'default';
@@ -172,8 +175,9 @@ export const addVertices = function (vert, g, svgId) {
/**
* Add edges to graph based on parsed graph defninition
* @param {Object} edges The edges to add to the graph
* @param {Object} g The graph object
*
* @param {object} edges The edges to add to the graph
* @param {object} g The graph object
*/
export const addEdges = function (edges, g) {
log.info('abc78 edges = ', edges);
@@ -317,6 +321,8 @@ export const addEdges = function (edges, g) {
/**
* Returns the all the styles from classDef statements in the graph definition.
*
* @param text
* @returns {object} classDef styles
*/
export const getClasses = function (text) {
@@ -337,6 +343,7 @@ export const getClasses = function (text) {
/**
* Draws a flowchart in the tag with id: id based on the graph definition in text.
*
* @param text
* @param id
*/

View File

@@ -22,8 +22,10 @@ export const setConf = function (cnf) {
/**
* Function that adds the vertices found in the graph definition to the graph to be rendered.
*
* @param vert Object containing the vertices.
* @param g The graph that is to be drawn.
* @param svgId
*/
export const addVertices = function (vert, g, svgId) {
const svg = select(`[id="${svgId}"]`);
@@ -35,6 +37,7 @@ export const addVertices = function (vert, g, svgId) {
/**
* Variable for storing the classes for the vertex
*
* @type {string}
*/
let classStr = 'default';
@@ -150,8 +153,9 @@ export const addVertices = function (vert, g, svgId) {
/**
* Add edges to graph based on parsed graph defninition
* @param {Object} edges The edges to add to the graph
* @param {Object} g The graph object
*
* @param {object} edges The edges to add to the graph
* @param {object} g The graph object
*/
export const addEdges = function (edges, g) {
let cnt = 0;
@@ -257,6 +261,8 @@ export const addEdges = function (edges, g) {
/**
* Returns the all the styles from classDef statements in the graph definition.
*
* @param text
* @returns {object} classDef styles
*/
export const getClasses = function (text) {
@@ -276,6 +282,7 @@ export const getClasses = function (text) {
/**
* Draws a flowchart in the tag with id: id based on the graph definition in text.
*
* @param text
* @param id
*/