diff --git a/.eslintrc.json b/.eslintrc.json
index bb057278f..5d7173991 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -25,6 +25,7 @@
"rules": {
"no-prototype-builtins": "off",
"no-unused-vars": "off",
+ "no-var": "error",
"jsdoc/check-indentation": "off",
"jsdoc/check-alignment": "off",
"jsdoc/check-line-alignment": "off",
diff --git a/cypress.config.js b/cypress.config.js
index 044c5d523..f755a67e1 100644
--- a/cypress.config.js
+++ b/cypress.config.js
@@ -1,3 +1,4 @@
+/* eslint-disable @typescript-eslint/no-var-requires */
const { defineConfig } = require('cypress');
const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin');
require('@applitools/eyes-cypress')(module);
diff --git a/cypress/platform/rerender.html b/cypress/platform/rerender.html
index 9b6cb130e..def5fa32d 100644
--- a/cypress/platform/rerender.html
+++ b/cypress/platform/rerender.html
@@ -17,9 +17,9 @@
rerender('XMas');
function rerender(text) {
- var graphText = `graph TD
+ let graphText = `graph TD
A[${text}] -->|Get money| B(Go shopping)`;
- var graph = mermaid.mermaidAPI.render('id', graphText);
+ let graph = mermaid.mermaidAPI.render('id', graphText);
console.log('\x1b[35m%s\x1b[0m', '>> graph', graph);
document.getElementById('graph').innerHTML = graph;
}
diff --git a/cypress/platform/xss10.html b/cypress/platform/xss10.html
index 6a027f514..b39728c84 100644
--- a/cypress/platform/xss10.html
+++ b/cypress/platform/xss10.html
@@ -93,7 +93,7 @@
throw new Error('XSS Succeeded');
}
- var diagram = 'classDiagram\n';
+ let diagram = 'classDiagram\n';
diagram += 'class Square~
~{\n";
diagram += 'id A\n';
diff --git a/cypress/platform/xss11.html b/cypress/platform/xss11.html
index 9126ac823..ca97aeaab 100644
--- a/cypress/platform/xss11.html
+++ b/cypress/platform/xss11.html
@@ -93,7 +93,7 @@
throw new Error('XSS Succeeded');
}
- var diagram = 'stateDiagram-v2\n';
+ let diagram = 'stateDiagram-v2\n';
diagram += 's2 : This is a state description
";
diff --git a/cypress/platform/xss12.html b/cypress/platform/xss12.html
index 5f6a3f229..eb1bce327 100644
--- a/cypress/platform/xss12.html
+++ b/cypress/platform/xss12.html
@@ -93,7 +93,7 @@
throw new Error('XSS Succeeded');
}
- var diagram = 'stateDiagram-v2\n';
+ let diagram = 'stateDiagram-v2\n';
diagram += 's2 : A
";
diff --git a/cypress/platform/xss13.html b/cypress/platform/xss13.html
index 41e868d5c..f2d90cddb 100644
--- a/cypress/platform/xss13.html
+++ b/cypress/platform/xss13.html
@@ -93,7 +93,7 @@
throw new Error('XSS Succeeded');
}
- var diagram = 'stateDiagram-v2\n';
+ let diagram = 'stateDiagram-v2\n';
diagram += 'if_state --> False: if n < 0
";
diff --git a/cypress/platform/xss14.html b/cypress/platform/xss14.html
index f3bdf8605..f429b355a 100644
--- a/cypress/platform/xss14.html
+++ b/cypress/platform/xss14.html
@@ -93,7 +93,7 @@
throw new Error('XSS Succeeded');
}
- var diagram = 'classDiagram\n';
+ let diagram = 'classDiagram\n';
diagram += 'classA <-- classB : parent.xssAttack(`XSS`)';
diff --git a/cypress/platform/xss15.html b/cypress/platform/xss15.html
index 5a3753d53..70ebe9f86 100644
--- a/cypress/platform/xss15.html
+++ b/cypress/platform/xss15.html
@@ -93,7 +93,7 @@
throw new Error('XSS Succeeded');
}
- var diagram = `sequenceDiagram
+ let diagram = `sequenceDiagram
participant John
links John: {"XSS": "javas`;
diagram += `cript:alert('AudioParam')"}`;
diff --git a/cypress/platform/xss16.html b/cypress/platform/xss16.html
index fe05206ce..9325a70aa 100644
--- a/cypress/platform/xss16.html
+++ b/cypress/platform/xss16.html
@@ -93,7 +93,7 @@
throw new Error('XSS Succeeded');
}
- var diagram = `sequenceDiagram
+ let diagram = `sequenceDiagram
participant Alice
links Alice: { "Click me!" : "javasjavascript:cript:alert('goose')" }`;
diff --git a/cypress/platform/xss17.html b/cypress/platform/xss17.html
index 95b52fcc6..c498f3f3e 100644
--- a/cypress/platform/xss17.html
+++ b/cypress/platform/xss17.html
@@ -93,7 +93,7 @@
throw new Error('XSS Succeeded');
}
- var diagram = `sequenceDiagram
+ let diagram = `sequenceDiagram
participant Alice
link Alice: Click Me!@javasjavascript:cript:alert("goose")`;
diff --git a/cypress/platform/xss18.html b/cypress/platform/xss18.html
index 6fb8ec69e..3e9cfd35c 100644
--- a/cypress/platform/xss18.html
+++ b/cypress/platform/xss18.html
@@ -93,7 +93,7 @@
throw new Error('XSS Succeeded');
}
- var diagram = `classDiagram
+ let diagram = `classDiagram
Class "
" <--> "
" C2: Cool label`;
// // var diagram = "stateDiagram-v2\n";
diff --git a/cypress/platform/xss19.html b/cypress/platform/xss19.html
index 590a195aa..ca747b39e 100644
--- a/cypress/platform/xss19.html
+++ b/cypress/platform/xss19.html
@@ -93,7 +93,7 @@
throw new Error('XSS Succeeded');
}
- var diagram = `classDiagram
+ let diagram = `classDiagram
class Shape{
<<
{
+ let cnt = 0;
+ let a;
+ let handler = setInterval(() => {
cnt++;
a = {};
if (typeof a.polluted !== 'undefined') {
diff --git a/cypress/platform/xss20.html b/cypress/platform/xss20.html
index 7b8aa9f85..9efd17215 100644
--- a/cypress/platform/xss20.html
+++ b/cypress/platform/xss20.html
@@ -96,7 +96,7 @@
// var diagram = ` graph TD
// A --> B["<a href='javasc`;
// diagram += `ript#colon;xssAttack()'>AAA</a>"]`;
- var diagram = ` graph TD
+ let diagram = ` graph TD
A --> B["AAA"]`;
// diagram += '//via.placeholder.com/64\' width=64 />"]';
diff --git a/cypress/platform/xss21.html b/cypress/platform/xss21.html
index e65a357ee..fed0e4289 100644
--- a/cypress/platform/xss21.html
+++ b/cypress/platform/xss21.html
@@ -96,7 +96,7 @@
// var diagram = ` graph TD
// A --> B["<a href='javasc`;
// diagram += `ript#colon;xssAttack()'>AAA</a>"]`;
- var diagram = ` graph TD
+ let diagram = ` graph TD
A --> B["AAA"]`;
// diagram += '//via.placeholder.com/64\' width=64 />"]';
diff --git a/cypress/platform/xss3.html b/cypress/platform/xss3.html
index b72e8743c..6964cbd2d 100644
--- a/cypress/platform/xss3.html
+++ b/cypress/platform/xss3.html
@@ -42,9 +42,9 @@
startOnLoad: true,
useMaxWidth: true,
});
- var cnt = 0;
- var a;
- var handler = setInterval(() => {
+ let cnt = 0;
+ let a;
+ let handler = setInterval(() => {
cnt++;
a = {};
if (typeof a.polluted !== 'undefined') {
diff --git a/cypress/platform/xss4.html b/cypress/platform/xss4.html
index b6e36edcd..924a65e08 100644
--- a/cypress/platform/xss4.html
+++ b/cypress/platform/xss4.html
@@ -85,7 +85,7 @@
alert('It worked');
}
- var diagram = '%%{init: {"flowchart": {"htmlLabels": "true"}} }%%\n';
+ let diagram = '%%{init: {"flowchart": {"htmlLabels": "true"}} }%%\n';
diagram += 'flowchart\n';
diagram += 'A["D("
\"\);\n";
diagram += 'script\x3a;xssAttack\u0028\u0029` src=x>");\n';
diff --git a/cypress/platform/xss6.html b/cypress/platform/xss6.html
index 0c70133b1..bc0f78561 100644
--- a/cypress/platform/xss6.html
+++ b/cypress/platform/xss6.html
@@ -92,7 +92,7 @@
document.getElementsByTagName('body')[0].appendChild(div);
throw new Error('XSS Succeeded');
}
- var diagram = 'graph LR\n';
+ let diagram = 'graph LR\n';
diagram += 'A(
)';
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
console.log(diagram);
diff --git a/cypress/platform/xss7.html b/cypress/platform/xss7.html
index 667a77d33..d8b2a7620 100644
--- a/cypress/platform/xss7.html
+++ b/cypress/platform/xss7.html
@@ -92,7 +92,7 @@
document.getElementsByTagName('body')[0].appendChild(div);
throw new Error('XSS Succeeded');
}
- var diagram = 'graph LR\n';
+ let diagram = 'graph LR\n';
diagram += " B(';
diagram += "script>Javascript:xssAttack`1`'>Click)";
diff --git a/cypress/platform/xss8.html b/cypress/platform/xss8.html
index 64211c778..cf2969f39 100644
--- a/cypress/platform/xss8.html
+++ b/cypress/platform/xss8.html
@@ -93,7 +93,7 @@
throw new Error('XSS Succeeded');
}
- var diagram = 'stateDiagram-v2\n';
+ let diagram = 'stateDiagram-v2\n';
diagram += "
--> B";
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
console.log(diagram);
diff --git a/cypress/platform/xss9.html b/cypress/platform/xss9.html
index 09c1d7f20..916f1506d 100644
--- a/cypress/platform/xss9.html
+++ b/cypress/platform/xss9.html
@@ -93,7 +93,7 @@
throw new Error('XSS Succeeded');
}
- var diagram = 'stateDiagram-v2\n';
+ let diagram = 'stateDiagram-v2\n';
diagram += "
--> B";
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
console.log(diagram);
diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js
index 2c98a54ad..ca5a37d5a 100644
--- a/cypress/plugins/index.js
+++ b/cypress/plugins/index.js
@@ -1,3 +1,4 @@
+/* eslint-disable @typescript-eslint/no-var-requires */
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
diff --git a/demos/dataflowchart.html b/demos/dataflowchart.html
index dea3d595a..c04a6f44b 100644
--- a/demos/dataflowchart.html
+++ b/demos/dataflowchart.html
@@ -42,7 +42,7 @@
@@ -622,10 +622,10 @@ Beginner's tip—a full example using interactive links in an HTML page:
@@ -719,10 +719,10 @@ Beginner's tip—here's a full example of using interactive links in HTML:
@@ -761,10 +761,10 @@ Beginner's tip—a full example using interactive links in a html context:
@@ -60,16 +60,16 @@
```
@@ -339,7 +339,7 @@ on what kind of integration you use.
```html
```
diff --git a/src/dagre-wrapper/edges.js b/src/dagre-wrapper/edges.js
index 86e41de1d..6041d5d2c 100644
--- a/src/dagre-wrapper/edges.js
+++ b/src/dagre-wrapper/edges.js
@@ -348,7 +348,7 @@ export const insertEdge = function (elem, e, edge, clusterDb, diagramType, graph
let points = edge.points;
let pointsHasChanged = false;
const tail = graph.node(e.v);
- var head = graph.node(e.w);
+ let head = graph.node(e.w);
log.info('abc88 InsertEdge: ', edge);
if (head.intersect && tail.intersect) {
diff --git a/src/dagre-wrapper/intersect/intersect-ellipse.js b/src/dagre-wrapper/intersect/intersect-ellipse.js
index 96f4a166e..24134b6b1 100644
--- a/src/dagre-wrapper/intersect/intersect-ellipse.js
+++ b/src/dagre-wrapper/intersect/intersect-ellipse.js
@@ -7,19 +7,19 @@
function intersectEllipse(node, rx, ry, point) {
// Formulae from: https://mathworld.wolfram.com/Ellipse-LineIntersection.html
- var cx = node.x;
- var cy = node.y;
+ let cx = node.x;
+ let cy = node.y;
- var px = cx - point.x;
- var py = cy - point.y;
+ let px = cx - point.x;
+ let py = cy - point.y;
- var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
+ let det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
- var dx = Math.abs((rx * ry * px) / det);
+ let dx = Math.abs((rx * ry * px) / det);
if (point.x < cx) {
dx = -dx;
}
- var dy = Math.abs((rx * ry * py) / det);
+ let dy = Math.abs((rx * ry * py) / det);
if (point.y < cy) {
dy = -dy;
}
diff --git a/src/dagre-wrapper/intersect/intersect-line.js b/src/dagre-wrapper/intersect/intersect-line.js
index f9ef0b15f..6b27fd24e 100644
--- a/src/dagre-wrapper/intersect/intersect-line.js
+++ b/src/dagre-wrapper/intersect/intersect-line.js
@@ -10,10 +10,10 @@ function intersectLine(p1, p2, q1, q2) {
// Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,
// p7 and p473.
- var a1, a2, b1, b2, c1, c2;
- var r1, r2, r3, r4;
- var denom, offset, num;
- var x, y;
+ let a1, a2, b1, b2, c1, c2;
+ let r1, r2, r3, r4;
+ let denom, offset, num;
+ let x, y;
// Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +
// b1 y + c1 = 0.
diff --git a/src/dagre-wrapper/intersect/intersect-polygon.js b/src/dagre-wrapper/intersect/intersect-polygon.js
index cd124150f..225a5ceee 100644
--- a/src/dagre-wrapper/intersect/intersect-polygon.js
+++ b/src/dagre-wrapper/intersect/intersect-polygon.js
@@ -13,13 +13,13 @@ export default intersectPolygon;
* @param point
*/
function intersectPolygon(node, polyPoints, point) {
- var x1 = node.x;
- var y1 = node.y;
+ let x1 = node.x;
+ let y1 = node.y;
- var intersections = [];
+ let intersections = [];
- var minX = Number.POSITIVE_INFINITY;
- var minY = Number.POSITIVE_INFINITY;
+ let minX = Number.POSITIVE_INFINITY;
+ let minY = Number.POSITIVE_INFINITY;
if (typeof polyPoints.forEach === 'function') {
polyPoints.forEach(function (entry) {
minX = Math.min(minX, entry.x);
@@ -30,13 +30,13 @@ function intersectPolygon(node, polyPoints, point) {
minY = Math.min(minY, polyPoints.y);
}
- var left = x1 - node.width / 2 - minX;
- var top = y1 - node.height / 2 - minY;
+ let left = x1 - node.width / 2 - minX;
+ let top = y1 - node.height / 2 - minY;
- for (var i = 0; i < polyPoints.length; i++) {
- var p1 = polyPoints[i];
- var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
- var intersect = intersectLine(
+ for (let i = 0; i < polyPoints.length; i++) {
+ let p1 = polyPoints[i];
+ let p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
+ let intersect = intersectLine(
node,
point,
{ x: left + p1.x, y: top + p1.y },
@@ -55,13 +55,13 @@ function intersectPolygon(node, polyPoints, point) {
if (intersections.length > 1) {
// More intersections, find the one nearest to edge end point
intersections.sort(function (p, q) {
- var pdx = p.x - point.x;
- var pdy = p.y - point.y;
- var distp = Math.sqrt(pdx * pdx + pdy * pdy);
+ let pdx = p.x - point.x;
+ let pdy = p.y - point.y;
+ let distp = Math.sqrt(pdx * pdx + pdy * pdy);
- var qdx = q.x - point.x;
- var qdy = q.y - point.y;
- var distq = Math.sqrt(qdx * qdx + qdy * qdy);
+ let qdx = q.x - point.x;
+ let qdy = q.y - point.y;
+ let distq = Math.sqrt(qdx * qdx + qdy * qdy);
return distp < distq ? -1 : distp === distq ? 0 : 1;
});
diff --git a/src/dagre-wrapper/intersect/intersect-rect.js b/src/dagre-wrapper/intersect/intersect-rect.js
index eb70f2fc7..2ffd59cd7 100644
--- a/src/dagre-wrapper/intersect/intersect-rect.js
+++ b/src/dagre-wrapper/intersect/intersect-rect.js
@@ -1,15 +1,15 @@
const intersectRect = (node, point) => {
- var x = node.x;
- var y = node.y;
+ let x = node.x;
+ let y = node.y;
// Rectangle intersection algorithm from:
// https://math.stackexchange.com/questions/108113/find-edge-between-two-boxes
- var dx = point.x - x;
- var dy = point.y - y;
- var w = node.width / 2;
- var h = node.height / 2;
+ let dx = point.x - x;
+ let dy = point.y - y;
+ let w = node.width / 2;
+ let h = node.height / 2;
- var sx, sy;
+ let sx, sy;
if (Math.abs(dy) * w > Math.abs(dx) * h) {
// Intersection is top or bottom of rect.
if (dy < 0) {
diff --git a/src/diagrams/c4/c4Db.js b/src/diagrams/c4/c4Db.js
index d53d6d31f..da8e08cc5 100644
--- a/src/diagrams/c4/c4Db.js
+++ b/src/diagrams/c4/c4Db.js
@@ -24,7 +24,7 @@ let wrapEnabled = false;
let description = '';
let c4ShapeInRow = 4;
let c4BoundaryInRow = 2;
-var c4Type;
+let c4Type;
export const getC4Type = function () {
return c4Type;
diff --git a/src/diagrams/c4/svgDraw.js b/src/diagrams/c4/svgDraw.js
index c67fb2649..e5c738299 100644
--- a/src/diagrams/c4/svgDraw.js
+++ b/src/diagrams/c4/svgDraw.js
@@ -38,7 +38,7 @@ export const drawEmbeddedImage = function (elem, x, y, link) {
const imageElem = elem.append('use');
imageElem.attr('x', x);
imageElem.attr('y', y);
- var sanitizedLink = sanitizeUrl(link);
+ let sanitizedLink = sanitizeUrl(link);
imageElem.attr('xlink:href', '#' + sanitizedLink);
};
diff --git a/src/diagrams/class/svgDraw.js b/src/diagrams/class/svgDraw.js
index 3d44e94b4..d302386e3 100644
--- a/src/diagrams/class/svgDraw.js
+++ b/src/diagrams/class/svgDraw.js
@@ -249,7 +249,7 @@ export const drawClass = function (elem, classDef, conf, diagObj) {
});
const classBox = g.node().getBBox();
- var cssClassStr = ' ';
+ let cssClassStr = ' ';
if (classDef.cssClasses.length > 0) {
cssClassStr = cssClassStr + classDef.cssClasses.join(' ');
diff --git a/src/diagrams/flowchart/flowRenderer-v2.js b/src/diagrams/flowchart/flowRenderer-v2.js
index 7d6e6d096..7f8791c7f 100644
--- a/src/diagrams/flowchart/flowRenderer-v2.js
+++ b/src/diagrams/flowchart/flowRenderer-v2.js
@@ -206,7 +206,7 @@ export const addEdges = function (edges, g, diagObj) {
cnt++;
// Identify Link
- var linkIdBase = 'L-' + edge.start + '-' + edge.end;
+ let linkIdBase = 'L-' + edge.start + '-' + edge.end;
// count the links from+to the same node to give unique id
if (typeof linkIdCnt[linkIdBase] === 'undefined') {
linkIdCnt[linkIdBase] = 0;
@@ -217,8 +217,8 @@ export const addEdges = function (edges, g, diagObj) {
}
let linkId = linkIdBase + '-' + linkIdCnt[linkIdBase];
log.info('abc78 new link id to be used is', linkIdBase, linkId, linkIdCnt[linkIdBase]);
- var linkNameStart = 'LS-' + edge.start;
- var linkNameEnd = 'LE-' + edge.end;
+ let linkNameStart = 'LS-' + edge.start;
+ let linkNameEnd = 'LE-' + edge.end;
const edgeData = { style: '', labelStyle: '' };
edgeData.minlen = edge.length || 1;
diff --git a/src/diagrams/flowchart/flowRenderer.js b/src/diagrams/flowchart/flowRenderer.js
index c6e6ebdd6..6eebf1ec3 100644
--- a/src/diagrams/flowchart/flowRenderer.js
+++ b/src/diagrams/flowchart/flowRenderer.js
@@ -178,9 +178,9 @@ export const addEdges = function (edges, g, diagObj) {
cnt++;
// Identify Link
- var linkId = 'L-' + edge.start + '-' + edge.end;
- var linkNameStart = 'LS-' + edge.start;
- var linkNameEnd = 'LE-' + edge.end;
+ let linkId = 'L-' + edge.start + '-' + edge.end;
+ let linkNameStart = 'LS-' + edge.start;
+ let linkNameEnd = 'LE-' + edge.end;
const edgeData = {};
diff --git a/src/diagrams/gantt/ganttRenderer.js b/src/diagrams/gantt/ganttRenderer.js
index f0866617f..54bfe7563 100644
--- a/src/diagrams/gantt/ganttRenderer.js
+++ b/src/diagrams/gantt/ganttRenderer.js
@@ -399,10 +399,10 @@ export const draw = function (text, id, version, diagObj) {
return typeof links[d.id] !== 'undefined';
})
.each(function (o) {
- var taskRect = doc.querySelector('#' + o.id);
- var taskText = doc.querySelector('#' + o.id + '-text');
+ let taskRect = doc.querySelector('#' + o.id);
+ let taskText = doc.querySelector('#' + o.id + '-text');
const oldParent = taskRect.parentNode;
- var Link = doc.createElement('a');
+ let Link = doc.createElement('a');
Link.setAttribute('xlink:href', links[o.id]);
Link.setAttribute('target', '_top');
oldParent.appendChild(Link);
diff --git a/src/diagrams/info/infoDb.js b/src/diagrams/info/infoDb.js
index 5a324fbb4..9f2d9dae6 100644
--- a/src/diagrams/info/infoDb.js
+++ b/src/diagrams/info/infoDb.js
@@ -1,8 +1,8 @@
/** Created by knut on 15-01-14. */
import { log } from '../../logger';
-var message = '';
-var info = false;
+let message = '';
+let info = false;
export const setMessage = (txt) => {
log.debug('Setting message to: ' + txt);
diff --git a/src/diagrams/mindmap/info.spc.js b/src/diagrams/mindmap/info.spc.js
index 3bdaa12e3..9cf2ad485 100644
--- a/src/diagrams/mindmap/info.spc.js
+++ b/src/diagrams/mindmap/info.spc.js
@@ -1,5 +1,5 @@
describe('when parsing an info graph it', function () {
- var ex;
+ let ex;
beforeEach(function () {
// eslint-disable-next-line @typescript-eslint/no-var-requires
ex = require('./parser/info').parser;
@@ -7,7 +7,7 @@ describe('when parsing an info graph it', function () {
});
it('should handle an info definition', function () {
- var str = `info
+ let str = `info
showInfo`;
ex.parse(str);
diff --git a/src/diagrams/mindmap/infoDb.js b/src/diagrams/mindmap/infoDb.js
index 5a324fbb4..9f2d9dae6 100644
--- a/src/diagrams/mindmap/infoDb.js
+++ b/src/diagrams/mindmap/infoDb.js
@@ -1,8 +1,8 @@
/** Created by knut on 15-01-14. */
import { log } from '../../logger';
-var message = '';
-var info = false;
+let message = '';
+let info = false;
export const setMessage = (txt) => {
log.debug('Setting message to: ' + txt);
diff --git a/src/diagrams/pie/pieRenderer.js b/src/diagrams/pie/pieRenderer.js
index b5ffc9de3..5c9dc2886 100644
--- a/src/diagrams/pie/pieRenderer.js
+++ b/src/diagrams/pie/pieRenderer.js
@@ -58,24 +58,24 @@ export const draw = (txt, id, _version, diagObj) => {
elem.setAttribute('viewBox', '0 0 ' + width + ' ' + height);
// Fetch the default direction, use TD if none was found
- var margin = 40;
- var legendRectSize = 18;
- var legendSpacing = 4;
+ let margin = 40;
+ let legendRectSize = 18;
+ let legendSpacing = 4;
- var radius = Math.min(width, height) / 2 - margin;
+ let radius = Math.min(width, height) / 2 - margin;
- var svg = diagram
+ let svg = diagram
.append('g')
.attr('transform', 'translate(' + width / 2 + ',' + height / 2 + ')');
- var data = diagObj.db.getSections();
- var sum = 0;
+ let data = diagObj.db.getSections();
+ let sum = 0;
Object.keys(data).forEach(function (key) {
sum += data[key];
});
const themeVariables = conf.themeVariables;
- var myGeneratedColors = [
+ let myGeneratedColors = [
themeVariables.pie1,
themeVariables.pie2,
themeVariables.pie3,
@@ -91,16 +91,16 @@ export const draw = (txt, id, _version, diagObj) => {
];
// Set the color scale
- var color = scaleOrdinal().range(myGeneratedColors);
+ let color = scaleOrdinal().range(myGeneratedColors);
// Compute the position of each group on the pie:
- var pie = d3pie().value(function (d) {
+ let pie = d3pie().value(function (d) {
return d[1];
});
- var dataReady = pie(Object.entries(data));
+ let dataReady = pie(Object.entries(data));
// Shape helper to build arcs:
- var arcGenerator = arc().innerRadius(0).outerRadius(radius);
+ let arcGenerator = arc().innerRadius(0).outerRadius(radius);
// Build the pie chart: each part of the pie is a path that we build using the arc function.
svg
@@ -138,17 +138,17 @@ export const draw = (txt, id, _version, diagObj) => {
.attr('class', 'pieTitleText');
// Add the legends/annotations for each section
- var legend = svg
+ let legend = svg
.selectAll('.legend')
.data(color.domain())
.enter()
.append('g')
.attr('class', 'legend')
.attr('transform', function (d, i) {
- var height = legendRectSize + legendSpacing;
- var offset = (height * color.domain().length) / 2;
- var horz = 12 * legendRectSize;
- var vert = i * height - offset;
+ let height = legendRectSize + legendSpacing;
+ let offset = (height * color.domain().length) / 2;
+ let horz = 12 * legendRectSize;
+ let vert = i * height - offset;
return 'translate(' + horz + ',' + vert + ')';
});
diff --git a/src/diagrams/sequence/sequenceDb.js b/src/diagrams/sequence/sequenceDb.js
index 7d0309127..c0c4d3c3c 100644
--- a/src/diagrams/sequence/sequenceDb.js
+++ b/src/diagrams/sequence/sequenceDb.js
@@ -259,11 +259,11 @@ export const addALink = function (actorId, text) {
try {
const links = {};
let sanitizedText = sanitizeText(text.text, configApi.getConfig());
- var sep = sanitizedText.indexOf('@');
+ let sep = sanitizedText.indexOf('@');
sanitizedText = sanitizedText.replace(/&/g, '&');
sanitizedText = sanitizedText.replace(/=/g, '=');
- var label = sanitizedText.slice(0, sep - 1).trim();
- var link = sanitizedText.slice(sep + 1).trim();
+ let label = sanitizedText.slice(0, sep - 1).trim();
+ let link = sanitizedText.slice(sep + 1).trim();
links[label] = link;
// add the deserialized text to the actor's links field.
diff --git a/src/diagrams/sequence/sequenceRenderer.js b/src/diagrams/sequence/sequenceRenderer.js
index a02f09b74..69239f7a9 100644
--- a/src/diagrams/sequence/sequenceRenderer.js
+++ b/src/diagrams/sequence/sequenceRenderer.js
@@ -494,12 +494,12 @@ export const drawActors = function (
};
export const drawActorsPopup = function (diagram, actors, actorKeys, doc) {
- var maxHeight = 0;
- var maxWidth = 0;
+ let maxHeight = 0;
+ let maxWidth = 0;
for (let i = 0; i < actorKeys.length; i++) {
const actor = actors[actorKeys[i]];
const minMenuWidth = getRequiredPopupWidth(actor);
- var menuDimensions = svgDraw.drawPopup(
+ let menuDimensions = svgDraw.drawPopup(
diagram,
actor,
minMenuWidth,
@@ -846,7 +846,7 @@ export const draw = function (_text, id, _version, diagObj) {
}
// only draw popups for the top row of actors.
- var requiredBoxSize = drawActorsPopup(diagram, actors, actorKeys, doc);
+ let requiredBoxSize = drawActorsPopup(diagram, actors, actorKeys, doc);
const { bounds: box } = bounds.getBounds();
diff --git a/src/diagrams/sequence/svgDraw.js b/src/diagrams/sequence/svgDraw.js
index fd70871e0..62daec9d2 100644
--- a/src/diagrams/sequence/svgDraw.js
+++ b/src/diagrams/sequence/svgDraw.js
@@ -49,7 +49,7 @@ export const drawPopup = function (elem, actor, minMenuWidth, textAttrs, forceMe
const actorCnt = actor.actorCnt;
const rectData = actor.rectData;
- var displayValue = 'none';
+ let displayValue = 'none';
if (forceMenus) {
displayValue = 'block !important';
}
@@ -59,7 +59,7 @@ export const drawPopup = function (elem, actor, minMenuWidth, textAttrs, forceMe
g.attr('class', 'actorPopupMenu');
g.attr('display', displayValue);
addPopupInteraction('#actor' + actorCnt + '_popup', actorCnt);
- var actorClass = '';
+ let actorClass = '';
if (typeof rectData.class !== 'undefined') {
actorClass = ' ' + rectData.class;
}
@@ -76,11 +76,11 @@ export const drawPopup = function (elem, actor, minMenuWidth, textAttrs, forceMe
rectElem.attr('height', rectData.height);
rectElem.attr('rx', rectData.rx);
rectElem.attr('ry', rectData.ry);
+ let linkY = 20;
if (links != null) {
- var linkY = 20;
for (let key in links) {
- var linkElem = g.append('a');
- var sanitizedLink = sanitizeUrl(links[key]);
+ let linkElem = g.append('a');
+ let sanitizedLink = sanitizeUrl(links[key]);
linkElem.attr('xlink:href', sanitizedLink);
linkElem.attr('target', '_blank');
@@ -108,7 +108,7 @@ export const drawImage = function (elem, x, y, link) {
const imageElem = elem.append('image');
imageElem.attr('x', x);
imageElem.attr('y', y);
- var sanitizedLink = sanitizeUrl(link);
+ let sanitizedLink = sanitizeUrl(link);
imageElem.attr('xlink:href', sanitizedLink);
};
@@ -116,7 +116,7 @@ export const drawEmbeddedImage = function (elem, x, y, link) {
const imageElem = elem.append('use');
imageElem.attr('x', x);
imageElem.attr('y', y);
- var sanitizedLink = sanitizeUrl(link);
+ let sanitizedLink = sanitizeUrl(link);
imageElem.attr('xlink:href', '#' + sanitizedLink);
};
@@ -137,14 +137,14 @@ export const popdownMenu = function (popid) {
};
const popupMenuUpFunc = function (popupId) {
- var pu = document.getElementById(popupId);
+ let pu = document.getElementById(popupId);
if (pu != null) {
pu.style.display = 'block';
}
};
const popupMenuDownFunc = function (popupId) {
- var pu = document.getElementById(popupId);
+ let pu = document.getElementById(popupId);
if (pu != null) {
pu.style.display = 'none';
}
@@ -340,7 +340,7 @@ const drawActorTypeParticipant = function (elem, actor, conf) {
const center = actor.x + actor.width / 2;
const boxpluslineGroup = elem.append('g');
- var g = boxpluslineGroup;
+ let g = boxpluslineGroup;
if (actor.y === 0) {
actorCnt++;
@@ -364,7 +364,7 @@ const drawActorTypeParticipant = function (elem, actor, conf) {
}
const rect = getNoteRect();
- var cssclass = 'actor';
+ let cssclass = 'actor';
if (actor.properties != null && actor.properties['class']) {
cssclass = actor.properties['class'];
} else {
diff --git a/src/docs.mts b/src/docs.mts
index 76594c4bf..5d22a935b 100644
--- a/src/docs.mts
+++ b/src/docs.mts
@@ -1,7 +1,7 @@
import { remark } from 'remark';
import type { Code, Root } from 'mdast';
import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs';
-// @ts-ignore
+// @ts-ignore: no types for this package
import flatmap from 'unist-util-flatmap';
import { globby } from 'globby';
import { join, dirname } from 'path';
diff --git a/src/docs/Setup.md b/src/docs/Setup.md
index a9d8e87e2..ba8d79789 100644
--- a/src/docs/Setup.md
+++ b/src/docs/Setup.md
@@ -1551,7 +1551,7 @@ Returns **void**
```html
@@ -451,10 +451,10 @@ Beginner's tip—a full example using interactive links in an HTML page:
@@ -471,10 +471,10 @@ Beginner's tip—here's a full example of using interactive links in HTML:
@@ -493,10 +493,10 @@ Beginner's tip—a full example using interactive links in a html context:
@@ -60,16 +60,16 @@
```
@@ -339,7 +339,7 @@ on what kind of integration you use.
```html
```