diff --git a/.eslintrc.json b/.eslintrc.json
index 02753280c..b8053795e 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -52,24 +52,25 @@
},
"overrides": [
{
- "files": "./**/*.html",
- "rules": {
- "no-undef": "off",
- "jsdoc/require-jsdoc": "off"
- }
- },
- {
- "files": ["./cypress/**", "./demos/**"],
+ "files": ["cypress/**", "demos/**"],
"rules": {
"no-console": "off"
}
},
{
- "files": ["./**/*.spec.{ts,js}", "./cypress/**", "./demos/**", "./**/docs/**"],
+ "files": ["*.spec.{ts,js}", "cypress/**", "demos/**", "**/docs/**"],
"rules": {
"jsdoc/require-jsdoc": "off",
"@typescript-eslint/no-unused-vars": "off"
}
+ },
+ {
+ "files": ["*.html", "*.md", "**/*.md/*"],
+ "rules": {
+ "no-var": "error",
+ "no-undef": "off",
+ "@typescript-eslint/no-unused-vars": "off"
+ }
}
]
}
diff --git a/__mocks__/dagre-d3.ts b/__mocks__/dagre-d3.ts
index a1a677591..bf6d341dc 100644
--- a/__mocks__/dagre-d3.ts
+++ b/__mocks__/dagre-d3.ts
@@ -1,3 +1 @@
-import { vi } from 'vitest';
-
-// export const render = vi.fn();
+// DO NOT delete this file. It is used by vitest to mock the dagre-d3 module.
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;
+ const 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..78fabc4aa 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;
+ const 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/demos/c4context.html b/demos/c4context.html
index ec7197b98..e085e611c 100644
--- a/demos/c4context.html
+++ b/demos/c4context.html
@@ -277,7 +277,7 @@
@@ -653,10 +653,10 @@ Beginner's tip—a full example using interactive links in an HTML page:
@@ -727,10 +727,10 @@ Beginner's tip—here's a full example of using interactive links in HTML:
@@ -771,10 +771,10 @@ Beginner's tip—a full example using interactive links in a html context:
@@ -51,16 +51,16 @@
```
@@ -339,7 +339,7 @@ on what kind of integration you use.
```html
```
diff --git a/packages/mermaid/src/docs/Setup.md b/packages/mermaid/src/docs/Setup.md
index 0c8f50bb8..95ae2dde4 100644
--- a/packages/mermaid/src/docs/Setup.md
+++ b/packages/mermaid/src/docs/Setup.md
@@ -1559,7 +1559,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:
@@ -495,10 +495,10 @@ Beginner's tip—a full example using interactive links in a html context:
@@ -51,16 +51,16 @@
```
@@ -339,7 +339,7 @@ on what kind of integration you use.
```html
```
diff --git a/vdocs/config/Setup.md b/vdocs/config/Setup.md
index bcf8ef583..fb58b78ea 100644
--- a/vdocs/config/Setup.md
+++ b/vdocs/config/Setup.md
@@ -29,7 +29,7 @@ mermaid.initialize({ flowchart: { htmlLabels: false } });
**Example 2:**
```js
-var config = {
+const config = {
startOnLoad: true,
flowchart: { useMaxWidth: true, htmlLabels: true, curve: 'cardinal' },
@@ -1560,7 +1560,7 @@ Returns **void**
```html
```
@@ -339,7 +339,7 @@ on what kind of integration you use.
```html
```
diff --git a/vdocs/syntax/classDiagram.md b/vdocs/syntax/classDiagram.md
index 87d76cd37..be77f1a1a 100644
--- a/vdocs/syntax/classDiagram.md
+++ b/vdocs/syntax/classDiagram.md
@@ -399,7 +399,7 @@ click Shape2 call callbackFunction() "This is a tooltip for a callback"
```html
@@ -451,10 +451,10 @@ Beginner's tip—a full example using interactive links in an HTML page:
@@ -502,10 +502,10 @@ Beginner's tip—a full example using interactive links in a html context: