chore: resolve eslint warnings in packages/mermaid/src/dagre-wrapper/nodes.js

This commit is contained in:
Sidharth Vinod
2025-04-19 10:21:43 +05:30
parent e4f19480cd
commit b11eb93ab2

View File

@@ -15,9 +15,7 @@ const formatClass = (str) => {
return ''; return '';
}; };
const getClassesFromNode = (node, otherClasses) => { const getClassesFromNode = (node, otherClasses) => {
return `${otherClasses ? otherClasses : 'node default'}${formatClass(node.classes)} ${formatClass( return `${otherClasses ?? 'node default'}${formatClass(node.classes)} ${formatClass(node.class)}`;
node.class
)}`;
}; };
const question = async (parent, node) => { const question = async (parent, node) => {
@@ -57,7 +55,7 @@ const choice = (parent, node) => {
const shapeSvg = parent const shapeSvg = parent
.insert('g') .insert('g')
.attr('class', 'node default') .attr('class', 'node default')
.attr('id', node.domId || node.id); .attr('id', node.domId ?? node.id);
const s = 28; const s = 28;
const points = [ const points = [
@@ -566,7 +564,7 @@ const rectWithTitle = (parent, node) => {
const shapeSvg = parent const shapeSvg = parent
.insert('g') .insert('g')
.attr('class', classes) .attr('class', classes)
.attr('id', node.domId || node.id); .attr('id', node.domId ?? node.id);
// Create the title label and insert it after the rect // Create the title label and insert it after the rect
const rect = shapeSvg.insert('rect', ':first-child'); const rect = shapeSvg.insert('rect', ':first-child');
@@ -808,7 +806,7 @@ const start = (parent, node) => {
const shapeSvg = parent const shapeSvg = parent
.insert('g') .insert('g')
.attr('class', 'node default') .attr('class', 'node default')
.attr('id', node.domId || node.id); .attr('id', node.domId ?? node.id);
const circle = shapeSvg.insert('circle', ':first-child'); const circle = shapeSvg.insert('circle', ':first-child');
// center the circle around its coordinate // center the circle around its coordinate
@@ -827,7 +825,7 @@ const forkJoin = (parent, node, dir) => {
const shapeSvg = parent const shapeSvg = parent
.insert('g') .insert('g')
.attr('class', 'node default') .attr('class', 'node default')
.attr('id', node.domId || node.id); .attr('id', node.domId ?? node.id);
let width = 70; let width = 70;
let height = 10; let height = 10;
@@ -859,7 +857,7 @@ const end = (parent, node) => {
const shapeSvg = parent const shapeSvg = parent
.insert('g') .insert('g')
.attr('class', 'node default') .attr('class', 'node default')
.attr('id', node.domId || node.id); .attr('id', node.domId ?? node.id);
const innerCircle = shapeSvg.insert('circle', ':first-child'); const innerCircle = shapeSvg.insert('circle', ':first-child');
const circle = shapeSvg.insert('circle', ':first-child'); const circle = shapeSvg.insert('circle', ':first-child');
@@ -891,7 +889,7 @@ const class_box = (parent, node) => {
const shapeSvg = parent const shapeSvg = parent
.insert('g') .insert('g')
.attr('class', classes) .attr('class', classes)
.attr('id', node.domId || node.id); .attr('id', node.domId ?? node.id);
// Create the title label and insert it after the rect // Create the title label and insert it after the rect
const rect = shapeSvg.insert('rect', ':first-child'); const rect = shapeSvg.insert('rect', ':first-child');