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~" <--> "" 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[" function testClick(nodeId) { console.log('clicked', nodeId); - var originalBgColor = document.querySelector('body').style.backgroundColor; + let originalBgColor = document.querySelector('body').style.backgroundColor; document.querySelector('body').style.backgroundColor = 'yellow'; setTimeout(function () { document.querySelector('body').style.backgroundColor = originalBgColor; diff --git a/demos/dataflowchart.html b/demos/dataflowchart.html index dc7fe05af..d49118ae0 100644 --- a/demos/dataflowchart.html +++ b/demos/dataflowchart.html @@ -46,7 +46,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: