From afe3f593e1e5bfcc0181b950e1fafee684f53184 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 18 Jan 2023 00:47:49 +0530 Subject: [PATCH] fix(#4003): Remove unhandled promises Add eslint rules to check for unhandled promises Fix all existing unhandled promise issues --- .eslintignore | 3 +- .eslintrc.cjs | 150 ++++++++++ .eslintrc.json | 137 --------- cypress/platform/viewer.js | 2 +- package.json | 8 +- packages/mermaid/src/Diagram.ts | 2 +- .../flowchart/elk/flowRenderer-elk.js | 259 ++++++++--------- packages/mermaid/src/docs.mts | 6 +- packages/mermaid/src/mermaid.ts | 19 +- pnpm-lock.yaml | 268 +++++++++++++----- scripts/jison/lint.mts | 6 +- tests/webpack/src/index.js | 6 +- tsconfig.eslint.json | 9 + 13 files changed, 504 insertions(+), 371 deletions(-) create mode 100644 .eslintrc.cjs delete mode 100644 .eslintrc.json create mode 100644 tsconfig.eslint.json diff --git a/.eslintignore b/.eslintignore index e1957aef9..04348c410 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,4 +3,5 @@ dist/** docs/Setup.md cypress.config.js cypress/plugins/index.js -coverage \ No newline at end of file +coverage +*.json \ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 000000000..e6f99a8bf --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,150 @@ +module.exports = { + env: { + browser: true, + es6: true, + 'jest/globals': true, + node: true, + }, + root: true, + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaFeatures: { + experimentalObjectRestSpread: true, + jsx: true, + }, + tsconfigRootDir: __dirname, + sourceType: 'module', + ecmaVersion: 2020, + allowAutomaticSingleRunInference: true, + project: ['./tsconfig.eslint.json', './packages/*/tsconfig.json'], + parser: '@typescript-eslint/parser', + }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:json/recommended', + 'plugin:markdown/recommended', + 'plugin:@cspell/recommended', + 'prettier', + ], + plugins: [ + '@typescript-eslint', + 'no-only-tests', + 'html', + 'jest', + 'jsdoc', + 'json', + '@cspell', + 'lodash', + 'unicorn', + ], + rules: { + curly: 'error', + 'no-console': 'error', + 'no-prototype-builtins': 'off', + 'no-unused-vars': 'off', + 'cypress/no-async-tests': 'off', + '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/no-misused-promises': 'error', + '@typescript-eslint/ban-ts-comment': [ + 'error', + { + 'ts-expect-error': 'allow-with-description', + 'ts-ignore': 'allow-with-description', + 'ts-nocheck': 'allow-with-description', + 'ts-check': 'allow-with-description', + minimumDescriptionLength: 10, + }, + ], + 'json/*': ['error', 'allowComments'], + '@cspell/spellchecker': [ + 'error', + { + checkIdentifiers: false, + checkStrings: false, + checkStringTemplates: false, + }, + ], + 'no-empty': [ + 'error', + { + allowEmptyCatch: true, + }, + ], + 'no-only-tests/no-only-tests': 'error', + 'lodash/import-scope': ['error', 'method'], + 'unicorn/better-regex': 'error', + 'unicorn/no-abusive-eslint-disable': 'error', + 'unicorn/no-array-push-push': 'error', + 'unicorn/no-for-loop': 'error', + 'unicorn/no-instanceof-array': 'error', + 'unicorn/no-typeof-undefined': 'error', + 'unicorn/no-unnecessary-await': 'error', + 'unicorn/no-unsafe-regex': 'warn', + 'unicorn/no-useless-promise-resolve-reject': 'error', + 'unicorn/prefer-array-find': 'error', + 'unicorn/prefer-array-flat-map': 'error', + 'unicorn/prefer-array-index-of': 'error', + 'unicorn/prefer-array-some': 'error', + 'unicorn/prefer-default-parameters': 'error', + 'unicorn/prefer-includes': 'error', + 'unicorn/prefer-negative-index': 'error', + 'unicorn/prefer-object-from-entries': 'error', + 'unicorn/prefer-string-starts-ends-with': 'error', + 'unicorn/prefer-string-trim-start-end': 'error', + 'unicorn/string-content': 'error', + 'unicorn/prefer-spread': 'error', + 'unicorn/no-lonely-if': 'error', + }, + overrides: [ + { + files: ['cypress/**', 'demos/**'], + rules: { + 'no-console': 'off', + }, + }, + { + files: ['*.{js,jsx,mjs,cjs}'], + extends: ['plugin:jsdoc/recommended'], + rules: { + 'jsdoc/check-indentation': 'off', + 'jsdoc/check-alignment': 'off', + 'jsdoc/check-line-alignment': 'off', + 'jsdoc/multiline-blocks': 'off', + 'jsdoc/newline-after-description': 'off', + 'jsdoc/tag-lines': 'off', + 'jsdoc/require-param-description': 'off', + 'jsdoc/require-param-type': 'off', + 'jsdoc/require-returns': 'off', + 'jsdoc/require-returns-description': 'off', + }, + }, + { + files: ['*.{ts,tsx}'], + plugins: ['tsdoc'], + rules: { + 'tsdoc/syntax': 'error', + }, + }, + { + 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', + '@typescript-eslint/no-floating-promises': 'off', + '@typescript-eslint/no-misused-promises': 'off', + }, + parserOptions: { + project: null, + }, + }, + ], +}; diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 9d7eacecd..000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "env": { - "browser": true, - "es6": true, - "jest/globals": true, - "node": true - }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaFeatures": { - "experimentalObjectRestSpread": true, - "jsx": true - }, - "sourceType": "module" - }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:json/recommended", - "plugin:markdown/recommended", - "plugin:@cspell/recommended", - "prettier" - ], - "plugins": [ - "@typescript-eslint", - "no-only-tests", - "html", - "jest", - "jsdoc", - "json", - "@cspell", - "lodash", - "unicorn" - ], - "rules": { - "curly": "error", - "no-console": "error", - "no-prototype-builtins": "off", - "no-unused-vars": "off", - "cypress/no-async-tests": "off", - "@typescript-eslint/ban-ts-comment": [ - "error", - { - "ts-expect-error": "allow-with-description", - "ts-ignore": "allow-with-description", - "ts-nocheck": "allow-with-description", - "ts-check": "allow-with-description", - "minimumDescriptionLength": 10 - } - ], - "json/*": ["error", "allowComments"], - "@cspell/spellchecker": [ - "error", - { - "checkIdentifiers": false, - "checkStrings": false, - "checkStringTemplates": false - } - ], - "no-empty": [ - "error", - { - "allowEmptyCatch": true - } - ], - "no-only-tests/no-only-tests": "error", - "lodash/import-scope": ["error", "method"], - "unicorn/better-regex": "error", - "unicorn/no-abusive-eslint-disable": "error", - "unicorn/no-array-push-push": "error", - "unicorn/no-for-loop": "error", - "unicorn/no-instanceof-array": "error", - "unicorn/no-typeof-undefined": "error", - "unicorn/no-unnecessary-await": "error", - "unicorn/no-unsafe-regex": "warn", - "unicorn/no-useless-promise-resolve-reject": "error", - "unicorn/prefer-array-find": "error", - "unicorn/prefer-array-flat-map": "error", - "unicorn/prefer-array-index-of": "error", - "unicorn/prefer-array-some": "error", - "unicorn/prefer-default-parameters": "error", - "unicorn/prefer-includes": "error", - "unicorn/prefer-negative-index": "error", - "unicorn/prefer-object-from-entries": "error", - "unicorn/prefer-string-starts-ends-with": "error", - "unicorn/prefer-string-trim-start-end": "error", - "unicorn/string-content": "error", - "unicorn/prefer-spread": "error", - "unicorn/no-lonely-if": "error" - }, - "overrides": [ - { - "files": ["cypress/**", "demos/**"], - "rules": { - "no-console": "off" - } - }, - { - "files": ["*.{js,jsx,mjs,cjs}"], - "extends": ["plugin:jsdoc/recommended"], - "rules": { - "jsdoc/check-indentation": "off", - "jsdoc/check-alignment": "off", - "jsdoc/check-line-alignment": "off", - "jsdoc/multiline-blocks": "off", - "jsdoc/newline-after-description": "off", - "jsdoc/tag-lines": "off", - "jsdoc/require-param-description": "off", - "jsdoc/require-param-type": "off", - "jsdoc/require-returns": "off", - "jsdoc/require-returns-description": "off" - } - }, - { - "files": ["*.{ts,tsx}"], - "plugins": ["tsdoc"], - "rules": { - "tsdoc/syntax": "error" - } - }, - { - "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/cypress/platform/viewer.js b/cypress/platform/viewer.js index c10ae73b1..01b49435f 100644 --- a/cypress/platform/viewer.js +++ b/cypress/platform/viewer.js @@ -151,7 +151,7 @@ if (typeof document !== 'undefined') { contentLoadedApi(); } else { this.console.log('Not using api'); - contentLoaded(); + void contentLoaded(); } }, false diff --git a/package.json b/package.json index 620f7dbeb..a9577c52c 100644 --- a/package.json +++ b/package.json @@ -67,8 +67,8 @@ "@types/node": "^18.11.9", "@types/prettier": "^2.7.1", "@types/rollup-plugin-visualizer": "^4.2.1", - "@typescript-eslint/eslint-plugin": "^5.42.1", - "@typescript-eslint/parser": "^5.42.1", + "@typescript-eslint/eslint-plugin": "^5.48.2", + "@typescript-eslint/parser": "^5.48.2", "@vitest/coverage-c8": "^0.27.0", "@vitest/ui": "^0.27.0", "concurrently": "^7.5.0", @@ -76,8 +76,8 @@ "cypress": "^10.11.0", "cypress-image-snapshot": "^4.0.1", "esbuild": "^0.17.0", - "eslint": "^8.27.0", - "eslint-config-prettier": "^8.5.0", + "eslint": "^8.32.0", + "eslint-config-prettier": "^8.6.0", "eslint-plugin-cypress": "^2.12.1", "eslint-plugin-html": "^7.1.0", "eslint-plugin-jest": "^27.1.5", diff --git a/packages/mermaid/src/Diagram.ts b/packages/mermaid/src/Diagram.ts index 4072ad14c..ed0762ece 100644 --- a/packages/mermaid/src/Diagram.ts +++ b/packages/mermaid/src/Diagram.ts @@ -6,7 +6,7 @@ import { extractFrontMatter } from './diagram-api/frontmatter'; import { isDetailedError } from './utils'; import type { DetailedError } from './utils'; -export type ParseErrorFunction = (err: string | DetailedError, hash?: any) => void; +export type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void; export class Diagram { type = 'graph'; diff --git a/packages/mermaid/src/diagrams/flowchart/elk/flowRenderer-elk.js b/packages/mermaid/src/diagrams/flowchart/elk/flowRenderer-elk.js index 36783dbb2..19ca0ccc1 100644 --- a/packages/mermaid/src/diagrams/flowchart/elk/flowRenderer-elk.js +++ b/packages/mermaid/src/diagrams/flowchart/elk/flowRenderer-elk.js @@ -609,7 +609,7 @@ const insertChildren = (nodeArray, parentLookupDb) => { * @param id */ -export const draw = function (text, id, _version, diagObj) { +export const draw = async function (text, id, _version, diagObj) { // Add temporary render element diagObj.db.clear(); nodeDb = {}; @@ -617,149 +617,128 @@ export const draw = function (text, id, _version, diagObj) { // Parse the graph definition diagObj.parser.parse(text); - return new Promise(function (resolve, reject) { - const renderEl = select('body').append('div').attr('style', 'height:400px').attr('id', 'cy'); - // .attr('style', 'display:none') - let graph = { - id: 'root', - layoutOptions: { - 'elk.hierarchyHandling': 'INCLUDE_CHILDREN', - // 'elk.hierarchyHandling': 'SEPARATE_CHILDREN', - 'org.eclipse.elk.padding': '[top=100, left=100, bottom=110, right=110]', - // 'org.eclipse.elk.layered.spacing.nodeNodeBetweenLayers': 120, - // 'elk.layered.spacing.nodeNodeBetweenLayers': '140', - 'elk.layered.spacing.edgeNodeBetweenLayers': '30', - // 'elk.algorithm': 'layered', - 'elk.direction': 'DOWN', - // 'elk.port.side': 'SOUTH', - // 'nodePlacement.strategy': 'SIMPLE', - // 'org.eclipse.elk.spacing.labelLabel': 120, - // 'org.eclipse.elk.graphviz.concentrate': true, - // 'org.eclipse.elk.spacing.nodeNode': 120, - // 'org.eclipse.elk.spacing.edgeEdge': 120, - // 'org.eclipse.elk.spacing.edgeNode': 120, - // 'org.eclipse.elk.spacing.nodeEdge': 120, - // 'org.eclipse.elk.spacing.componentComponent': 120, - }, - children: [], - edges: [], - }; - log.info('Drawing flowchart using v3 renderer'); + const renderEl = select('body').append('div').attr('style', 'height:400px').attr('id', 'cy'); + let graph = { + id: 'root', + layoutOptions: { + 'elk.hierarchyHandling': 'INCLUDE_CHILDREN', + 'org.eclipse.elk.padding': '[top=100, left=100, bottom=110, right=110]', + 'elk.layered.spacing.edgeNodeBetweenLayers': '30', + 'elk.direction': 'DOWN', + }, + children: [], + edges: [], + }; + log.info('Drawing flowchart using v3 renderer'); - // Set the direction, - // Fetch the default direction, use TD if none was found - let dir = diagObj.db.getDirection(); - switch (dir) { - case 'BT': - graph.layoutOptions['elk.direction'] = 'UP'; - break; - case 'TB': - graph.layoutOptions['elk.direction'] = 'DOWN'; - break; - case 'LR': - graph.layoutOptions['elk.direction'] = 'RIGHT'; - break; - case 'RL': - graph.layoutOptions['elk.direction'] = 'LEFT'; - break; + // Set the direction, + // Fetch the default direction, use TD if none was found + let dir = diagObj.db.getDirection(); + switch (dir) { + case 'BT': + graph.layoutOptions['elk.direction'] = 'UP'; + break; + case 'TB': + graph.layoutOptions['elk.direction'] = 'DOWN'; + break; + case 'LR': + graph.layoutOptions['elk.direction'] = 'RIGHT'; + break; + case 'RL': + graph.layoutOptions['elk.direction'] = 'LEFT'; + break; + } + const { securityLevel, flowchart: conf } = getConfig(); + + // Find the root dom node to ne used in rendering + // Handle root and document for when rendering in sandbox mode + let sandboxElement; + if (securityLevel === 'sandbox') { + sandboxElement = select('#i' + id); + } + const root = + securityLevel === 'sandbox' + ? select(sandboxElement.nodes()[0].contentDocument.body) + : select('body'); + const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; + + const svg = root.select(`[id="${id}"]`); + + // Define the supported markers for the diagram + const markers = ['point', 'circle', 'cross']; + + // Add the marker definitions to the svg as marker tags + insertMarkers(svg, markers, diagObj.type, diagObj.arrowMarkerAbsolute); + + // Fetch the vertices/nodes and edges/links from the parsed graph definition + const vert = diagObj.db.getVertices(); + + // Setup nodes from the subgraphs with type group, these will be used + // as nodes with children in the subgraph + let subG; + const subGraphs = diagObj.db.getSubGraphs(); + log.info('Subgraphs - ', subGraphs); + for (let i = subGraphs.length - 1; i >= 0; i--) { + subG = subGraphs[i]; + diagObj.db.addVertex(subG.id, subG.title, 'group', undefined, subG.classes, subG.dir); + } + + // Add an element in the svg to be used to hold the subgraphs container + // elements + const subGraphsEl = svg.insert('g').attr('class', 'subgraphs'); + + // Create the lookup db for the subgraphs and their children to used when creating + // the tree structured graph + const parentLookupDb = addSubGraphs(diagObj.db); + + // Add the nodes to the graph, this will entail creating the actual nodes + // in order to get the size of the node. You can't get the size of a node + // that is not in the dom so we need to add it to the dom, get the size + // we will position the nodes when we get the layout from elkjs + graph = addVertices(vert, id, root, doc, diagObj, parentLookupDb, graph); + + // Time for the edges, we start with adding an element in the node to hold the edges + const edgesEl = svg.insert('g').attr('class', 'edges edgePath'); + // Fetch the edges form the parsed graph definition + const edges = diagObj.db.getEdges(); + + // Add the edges to the graph, this will entail creating the actual edges + graph = addEdges(edges, diagObj, graph, svg); + + // Iterate through all nodes and add the top level nodes to the graph + const nodes = Object.keys(nodeDb); + nodes.forEach((nodeId) => { + const node = nodeDb[nodeId]; + if (!node.parent) { + graph.children.push(node); } - const { securityLevel, flowchart: conf } = getConfig(); - - // Find the root dom node to ne used in rendering - // Handle root and document for when rendering in sandbox mode - let sandboxElement; - if (securityLevel === 'sandbox') { - sandboxElement = select('#i' + id); - } - const root = - securityLevel === 'sandbox' - ? select(sandboxElement.nodes()[0].contentDocument.body) - : select('body'); - const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; - - const svg = root.select(`[id="${id}"]`); - - // Define the supported markers for the diagram - const markers = ['point', 'circle', 'cross']; - - // Add the marker definitions to the svg as marker tags - insertMarkers(svg, markers, diagObj.type, diagObj.arrowMarkerAbsolute); - - // Fetch the vertices/nodes and edges/links from the parsed graph definition - const vert = diagObj.db.getVertices(); - - // Setup nodes from the subgraphs with type group, these will be used - // as nodes with children in the subgraph - let subG; - const subGraphs = diagObj.db.getSubGraphs(); - log.info('Subgraphs - ', subGraphs); - for (let i = subGraphs.length - 1; i >= 0; i--) { - subG = subGraphs[i]; - diagObj.db.addVertex(subG.id, subG.title, 'group', undefined, subG.classes, subG.dir); - } - - // Add an element in the svg to be used to hold the subgraphs container - // elements - const subGraphsEl = svg.insert('g').attr('class', 'subgraphs'); - - // Create the lookup db for the subgraphs and their children to used when creating - // the tree structured graph - const parentLookupDb = addSubGraphs(diagObj.db); - - // Add the nodes to the graph, this will entail creating the actual nodes - // in order to get the size of the node. You can't get the size of a node - // that is not in the dom so we need to add it to the dom, get the size - // we will position the nodes when we get the layout from elkjs - graph = addVertices(vert, id, root, doc, diagObj, parentLookupDb, graph); - - // Time for the edges, we start with adding an element in the node to hold the edges - const edgesEl = svg.insert('g').attr('class', 'edges edgePath'); - // Fetch the edges form the parsed graph definition - const edges = diagObj.db.getEdges(); - - // Add the edges to the graph, this will entail creating the actual edges - graph = addEdges(edges, diagObj, graph, svg); - - // Iterate through all nodes and add the top level nodes to the graph - const nodes = Object.keys(nodeDb); - nodes.forEach((nodeId) => { - const node = nodeDb[nodeId]; - if (!node.parent) { - graph.children.push(node); - } - // node.nodePadding = [120, 50, 50, 50]; - // node['org.eclipse.elk.spacing.nodeNode'] = 120; - // Subgraph - if (parentLookupDb.childrenById[nodeId] !== undefined) { - node.labels = [ - { - text: node.labelText, - layoutOptions: { - 'nodeLabels.placement': '[H_CENTER, V_TOP, INSIDE]', - }, - width: node.labelData.width, - height: node.labelData.height, + // Subgraph + if (parentLookupDb.childrenById[nodeId] !== undefined) { + node.labels = [ + { + text: node.labelText, + layoutOptions: { + 'nodeLabels.placement': '[H_CENTER, V_TOP, INSIDE]', }, - ]; - delete node.x; - delete node.y; - delete node.width; - delete node.height; - } - }); - insertChildren(graph.children, parentLookupDb); - elk.layout(graph).then(function (g) { - drawNodes(0, 0, g.children, svg, subGraphsEl, diagObj, 0); - - g.edges.map((edge, id) => { - insertEdge(edgesEl, edge, edge.edgeData, diagObj, parentLookupDb); - }); - setupGraphViewbox({}, svg, conf.diagramPadding, conf.useMaxWidth); - resolve(); - }); - // Remove element after layout - renderEl.remove(); + width: node.labelData.width, + height: node.labelData.height, + }, + ]; + delete node.x; + delete node.y; + delete node.width; + delete node.height; + } }); + insertChildren(graph.children, parentLookupDb); + const g = await elk.layout(graph); + drawNodes(0, 0, g.children, svg, subGraphsEl, diagObj, 0); + g.edges?.map((edge) => { + insertEdge(edgesEl, edge, edge.edgeData, diagObj, parentLookupDb); + }); + setupGraphViewbox({}, svg, conf.diagramPadding, conf.useMaxWidth); + // Remove element after layout + renderEl.remove(); }; const drawNodes = (relX, relY, nodeArray, svg, subgraphsEl, diagObj, depth) => { diff --git a/packages/mermaid/src/docs.mts b/packages/mermaid/src/docs.mts index 99da3f381..33649ce6d 100644 --- a/packages/mermaid/src/docs.mts +++ b/packages/mermaid/src/docs.mts @@ -331,7 +331,7 @@ const getFilesFromGlobs = async (globs: string[]): Promise => { }; /** Main method (entry point) */ -(async () => { +const main = async () => { if (verifyOnly) { console.log('Verifying that all files are in sync with the source files'); } @@ -400,4 +400,6 @@ const getFilesFromGlobs = async (globs: string[]): Promise => { } }); } -})(); +}; + +void main(); diff --git a/packages/mermaid/src/mermaid.ts b/packages/mermaid/src/mermaid.ts index 3c09d2c92..b859a6a84 100644 --- a/packages/mermaid/src/mermaid.ts +++ b/packages/mermaid/src/mermaid.ts @@ -17,7 +17,6 @@ import { ExternalDiagramDefinition } from './diagram-api/types'; export type { MermaidConfig, DetailedError, ExternalDiagramDefinition, ParseErrorFunction }; -let externalDiagramsRegistered = false; /** * ## init * @@ -51,12 +50,7 @@ const init = async function ( callback?: Function ) { try { - // Not really sure if we need to check this, or simply call initThrowsErrorsAsync directly. - if (externalDiagramsRegistered) { - await initThrowsErrorsAsync(config, nodes, callback); - } else { - initThrowsErrors(config, nodes, callback); - } + await initThrowsErrorsAsync(config, nodes, callback); } catch (e) { log.warn('Syntax Error rendering'); if (isDetailedError(e)) { @@ -68,8 +62,7 @@ const init = async function ( } }; -// eslint-disable-next-line @typescript-eslint/ban-types -const handleError = (error: unknown, errors: DetailedError[], parseError?: Function) => { +const handleError = (error: unknown, errors: DetailedError[], parseError?: ParseErrorFunction) => { log.warn(error); if (isDetailedError(error)) { // handle case where error string and hash were @@ -225,7 +218,6 @@ const loadExternalDiagrams = async (...diagrams: ExternalDiagramDefinition[]) => */ const initThrowsErrorsAsync = async function ( config?: MermaidConfig, - // eslint-disable-next-line no-undef nodes?: string | HTMLElement | NodeListOf, // eslint-disable-next-line @typescript-eslint/ban-types callback?: Function @@ -336,7 +328,6 @@ const registerExternalDiagrams = async ( } else { await loadExternalDiagrams(...diagrams); } - externalDiagramsRegistered = true; }; /** @@ -348,7 +339,7 @@ const contentLoaded = function () { if (mermaid.startOnLoad) { const { startOnLoad } = mermaidAPI.getConfig(); if (startOnLoad) { - mermaid.init(); + void mermaid.init(); } } }; @@ -427,7 +418,7 @@ const parseAsync = (txt: string): Promise => { ); }); executionQueue.push(performCall); - executeQueue(); + void executeQueue(); }); }; @@ -460,7 +451,7 @@ const renderAsync = ( ); }); executionQueue.push(performCall); - executeQueue(); + void executeQueue(); }); }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dfc788597..53017ba5b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -44,11 +44,11 @@ importers: specifier: ^4.2.1 version: 4.2.1 '@typescript-eslint/eslint-plugin': - specifier: ^5.42.1 - version: 5.42.1_2udltptbznfmezdozpdoa2aemq + specifier: ^5.48.2 + version: 5.48.2_iljmjqxcygjq3saipl7gerxpvi '@typescript-eslint/parser': - specifier: ^5.42.1 - version: 5.42.1_rmayb2veg2btbq6mbmnyivgasy + specifier: ^5.48.2 + version: 5.48.2_yygwinqv3a2io74xmwofqb7uka '@vitest/coverage-c8': specifier: ^0.27.0 version: 0.27.1_6vhkb7zox2ro6wmx3rlvm5i5ce @@ -71,32 +71,32 @@ importers: specifier: ^0.17.0 version: 0.17.0 eslint: - specifier: ^8.27.0 - version: 8.27.0 + specifier: ^8.32.0 + version: 8.32.0 eslint-config-prettier: - specifier: ^8.5.0 - version: 8.5.0_eslint@8.27.0 + specifier: ^8.6.0 + version: 8.6.0_eslint@8.32.0 eslint-plugin-cypress: specifier: ^2.12.1 - version: 2.12.1_eslint@8.27.0 + version: 2.12.1_eslint@8.32.0 eslint-plugin-html: specifier: ^7.1.0 version: 7.1.0 eslint-plugin-jest: specifier: ^27.1.5 - version: 27.1.5_kdswgjmqcx7mthqz7ow2zlfevy + version: 27.1.5_5rcd23qw3h5vuffwo2owxb3hw4 eslint-plugin-jsdoc: specifier: ^39.6.2 - version: 39.6.2_eslint@8.27.0 + version: 39.6.2_eslint@8.32.0 eslint-plugin-json: specifier: ^3.1.0 version: 3.1.0 eslint-plugin-lodash: specifier: ^7.4.0 - version: 7.4.0_eslint@8.27.0 + version: 7.4.0_eslint@8.32.0 eslint-plugin-markdown: specifier: ^3.0.0 - version: 3.0.0_eslint@8.27.0 + version: 3.0.0_eslint@8.32.0 eslint-plugin-no-only-tests: specifier: ^3.1.0 version: 3.1.0 @@ -105,7 +105,7 @@ importers: version: 0.2.17 eslint-plugin-unicorn: specifier: ^45.0.0 - version: 45.0.0_eslint@8.27.0 + version: 45.0.0_eslint@8.32.0 express: specifier: ^4.18.2 version: 4.18.2 @@ -229,10 +229,10 @@ importers: version: 8.3.4 '@typescript-eslint/eslint-plugin': specifier: ^5.42.1 - version: 5.42.1_2udltptbznfmezdozpdoa2aemq + version: 5.42.1_qxgr6oy2qtsmmpo3f6iejuryuq '@typescript-eslint/parser': specifier: ^5.42.1 - version: 5.42.1_rmayb2veg2btbq6mbmnyivgasy + version: 5.42.1_yygwinqv3a2io74xmwofqb7uka chokidar: specifier: ^3.5.3 version: 3.5.3 @@ -336,6 +336,9 @@ importers: specifier: ^2.0.2 version: 2.0.2 devDependencies: + '@types/cytoscape': + specifier: ^3.19.9 + version: 3.19.9 concurrently: specifier: ^7.5.0 version: 7.5.0 @@ -2144,14 +2147,14 @@ packages: dev: true optional: true - /@eslint/eslintrc/1.3.3: - resolution: {integrity: sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==} + /@eslint/eslintrc/1.4.1: + resolution: {integrity: sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 debug: 4.3.4 espree: 9.4.0 - globals: 13.17.0 + globals: 13.19.0 ignore: 5.2.0 import-fresh: 3.3.0 js-yaml: 4.1.0 @@ -2171,8 +2174,8 @@ packages: '@hapi/hoek': 9.3.0 dev: true - /@humanwhocodes/config-array/0.11.7: - resolution: {integrity: sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==} + /@humanwhocodes/config-array/0.11.8: + resolution: {integrity: sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==} engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 1.2.1 @@ -2656,6 +2659,10 @@ packages: '@types/node': 18.11.9 dev: true + /@types/cytoscape/3.19.9: + resolution: {integrity: sha512-oqCx0ZGiBO0UESbjgq052vjDAy2X53lZpMrWqiweMpvVwKw/2IiYDdzPFK6+f4tMfdv9YKEM9raO5bAZc3UYBg==} + dev: true + /@types/d3-array/3.0.3: resolution: {integrity: sha512-Reoy+pKnvsksN0lQUlcH6dOGjRZ/3WRwXR//m+/8lt1BXeI4xyaUZoqULNjyXXRuh0Mj4LNpkCvhUpQlY3X5xQ==} dev: true @@ -3136,7 +3143,7 @@ packages: dev: true optional: true - /@typescript-eslint/eslint-plugin/5.42.1_2udltptbznfmezdozpdoa2aemq: + /@typescript-eslint/eslint-plugin/5.42.1_qxgr6oy2qtsmmpo3f6iejuryuq: resolution: {integrity: sha512-LyR6x784JCiJ1j6sH5Y0K6cdExqCCm8DJUTcwG5ThNXJj/G8o5E56u5EdG4SLy+bZAwZBswC+GYn3eGdttBVCg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -3147,12 +3154,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.42.1_rmayb2veg2btbq6mbmnyivgasy + '@typescript-eslint/parser': 5.42.1_yygwinqv3a2io74xmwofqb7uka '@typescript-eslint/scope-manager': 5.42.1 - '@typescript-eslint/type-utils': 5.42.1_rmayb2veg2btbq6mbmnyivgasy - '@typescript-eslint/utils': 5.42.1_rmayb2veg2btbq6mbmnyivgasy + '@typescript-eslint/type-utils': 5.42.1_yygwinqv3a2io74xmwofqb7uka + '@typescript-eslint/utils': 5.42.1_yygwinqv3a2io74xmwofqb7uka debug: 4.3.4 - eslint: 8.27.0 + eslint: 8.32.0 ignore: 5.2.0 natural-compare-lite: 1.4.0 regexpp: 3.2.0 @@ -3163,7 +3170,34 @@ packages: - supports-color dev: true - /@typescript-eslint/parser/5.42.1_rmayb2veg2btbq6mbmnyivgasy: + /@typescript-eslint/eslint-plugin/5.48.2_iljmjqxcygjq3saipl7gerxpvi: + resolution: {integrity: sha512-sR0Gja9Ky1teIq4qJOl0nC+Tk64/uYdX+mi+5iB//MH8gwyx8e3SOyhEzeLZEFEEfCaLf8KJq+Bd/6je1t+CAg==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + '@typescript-eslint/parser': ^5.0.0 + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/parser': 5.48.2_yygwinqv3a2io74xmwofqb7uka + '@typescript-eslint/scope-manager': 5.48.2 + '@typescript-eslint/type-utils': 5.48.2_yygwinqv3a2io74xmwofqb7uka + '@typescript-eslint/utils': 5.48.2_yygwinqv3a2io74xmwofqb7uka + debug: 4.3.4 + eslint: 8.32.0 + ignore: 5.2.0 + natural-compare-lite: 1.4.0 + regexpp: 3.2.0 + semver: 7.3.8 + tsutils: 3.21.0_typescript@4.8.4 + typescript: 4.8.4 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/parser/5.42.1_yygwinqv3a2io74xmwofqb7uka: resolution: {integrity: sha512-kAV+NiNBWVQDY9gDJDToTE/NO8BHi4f6b7zTsVAJoTkmB/zlfOpiEVBzHOKtlgTndCKe8vj9F/PuolemZSh50Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -3177,7 +3211,27 @@ packages: '@typescript-eslint/types': 5.42.1 '@typescript-eslint/typescript-estree': 5.42.1_typescript@4.8.4 debug: 4.3.4 - eslint: 8.27.0 + eslint: 8.32.0 + typescript: 4.8.4 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/parser/5.48.2_yygwinqv3a2io74xmwofqb7uka: + resolution: {integrity: sha512-38zMsKsG2sIuM5Oi/olurGwYJXzmtdsHhn5mI/pQogP+BjYVkK5iRazCQ8RGS0V+YLk282uWElN70zAAUmaYHw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/scope-manager': 5.48.2 + '@typescript-eslint/types': 5.48.2 + '@typescript-eslint/typescript-estree': 5.48.2_typescript@4.8.4 + debug: 4.3.4 + eslint: 8.32.0 typescript: 4.8.4 transitivePeerDependencies: - supports-color @@ -3191,7 +3245,15 @@ packages: '@typescript-eslint/visitor-keys': 5.42.1 dev: true - /@typescript-eslint/type-utils/5.42.1_rmayb2veg2btbq6mbmnyivgasy: + /@typescript-eslint/scope-manager/5.48.2: + resolution: {integrity: sha512-zEUFfonQid5KRDKoI3O+uP1GnrFd4tIHlvs+sTJXiWuypUWMuDaottkJuR612wQfOkjYbsaskSIURV9xo4f+Fw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + '@typescript-eslint/types': 5.48.2 + '@typescript-eslint/visitor-keys': 5.48.2 + dev: true + + /@typescript-eslint/type-utils/5.42.1_yygwinqv3a2io74xmwofqb7uka: resolution: {integrity: sha512-WWiMChneex5w4xPIX56SSnQQo0tEOy5ZV2dqmj8Z371LJ0E+aymWD25JQ/l4FOuuX+Q49A7pzh/CGIQflxMVXg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -3202,9 +3264,29 @@ packages: optional: true dependencies: '@typescript-eslint/typescript-estree': 5.42.1_typescript@4.8.4 - '@typescript-eslint/utils': 5.42.1_rmayb2veg2btbq6mbmnyivgasy + '@typescript-eslint/utils': 5.42.1_yygwinqv3a2io74xmwofqb7uka debug: 4.3.4 - eslint: 8.27.0 + eslint: 8.32.0 + tsutils: 3.21.0_typescript@4.8.4 + typescript: 4.8.4 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/type-utils/5.48.2_yygwinqv3a2io74xmwofqb7uka: + resolution: {integrity: sha512-QVWx7J5sPMRiOMJp5dYshPxABRoZV1xbRirqSk8yuIIsu0nvMTZesKErEA3Oix1k+uvsk8Cs8TGJ6kQ0ndAcew==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: '*' + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/typescript-estree': 5.48.2_typescript@4.8.4 + '@typescript-eslint/utils': 5.48.2_yygwinqv3a2io74xmwofqb7uka + debug: 4.3.4 + eslint: 8.32.0 tsutils: 3.21.0_typescript@4.8.4 typescript: 4.8.4 transitivePeerDependencies: @@ -3216,6 +3298,11 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true + /@typescript-eslint/types/5.48.2: + resolution: {integrity: sha512-hE7dA77xxu7ByBc6KCzikgfRyBCTst6dZQpwaTy25iMYOnbNljDT4hjhrGEJJ0QoMjrfqrx+j1l1B9/LtKeuqA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dev: true + /@typescript-eslint/typescript-estree/5.42.1_typescript@4.8.4: resolution: {integrity: sha512-qElc0bDOuO0B8wDhhW4mYVgi/LZL+igPwXtV87n69/kYC/7NG3MES0jHxJNCr4EP7kY1XVsRy8C/u3DYeTKQmw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -3237,7 +3324,28 @@ packages: - supports-color dev: true - /@typescript-eslint/utils/5.42.1_rmayb2veg2btbq6mbmnyivgasy: + /@typescript-eslint/typescript-estree/5.48.2_typescript@4.8.4: + resolution: {integrity: sha512-bibvD3z6ilnoVxUBFEgkO0k0aFvUc4Cttt0dAreEr+nrAHhWzkO83PEVVuieK3DqcgL6VAK5dkzK8XUVja5Zcg==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 5.48.2 + '@typescript-eslint/visitor-keys': 5.48.2 + debug: 4.3.4 + globby: 11.1.0 + is-glob: 4.0.3 + semver: 7.3.8 + tsutils: 3.21.0_typescript@4.8.4 + typescript: 4.8.4 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/utils/5.42.1_yygwinqv3a2io74xmwofqb7uka: resolution: {integrity: sha512-Gxvf12xSp3iYZd/fLqiQRD4uKZjDNR01bQ+j8zvhPjpsZ4HmvEFL/tC4amGNyxN9Rq+iqvpHLhlqx6KTxz9ZyQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -3248,9 +3356,29 @@ packages: '@typescript-eslint/scope-manager': 5.42.1 '@typescript-eslint/types': 5.42.1 '@typescript-eslint/typescript-estree': 5.42.1_typescript@4.8.4 - eslint: 8.27.0 + eslint: 8.32.0 eslint-scope: 5.1.1 - eslint-utils: 3.0.0_eslint@8.27.0 + eslint-utils: 3.0.0_eslint@8.32.0 + semver: 7.3.8 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + + /@typescript-eslint/utils/5.48.2_yygwinqv3a2io74xmwofqb7uka: + resolution: {integrity: sha512-2h18c0d7jgkw6tdKTlNaM7wyopbLRBiit8oAxoP89YnuBOzCZ8g8aBCaCqq7h208qUTroL7Whgzam7UY3HVLow==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + dependencies: + '@types/json-schema': 7.0.11 + '@types/semver': 7.3.12 + '@typescript-eslint/scope-manager': 5.48.2 + '@typescript-eslint/types': 5.48.2 + '@typescript-eslint/typescript-estree': 5.48.2_typescript@4.8.4 + eslint: 8.32.0 + eslint-scope: 5.1.1 + eslint-utils: 3.0.0_eslint@8.32.0 semver: 7.3.8 transitivePeerDependencies: - supports-color @@ -3265,6 +3393,14 @@ packages: eslint-visitor-keys: 3.3.0 dev: true + /@typescript-eslint/visitor-keys/5.48.2: + resolution: {integrity: sha512-z9njZLSkwmjFWUelGEwEbdf4NwKvfHxvGC0OcGN1Hp/XNDIcJ7D5DpPNPv6x6/mFvc1tQHsaWmpD/a4gOvvCJQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + '@typescript-eslint/types': 5.48.2 + eslint-visitor-keys: 3.3.0 + dev: true + /@vitejs/plugin-vue/4.0.0_vite@4.0.1+vue@3.2.45: resolution: {integrity: sha512-e0X4jErIxAB5oLtDqbHvHpJe/uWNkdpYV83AOG2xo2tEVSzCzewgJMtREZM30wXnM5ls90hxiOtAuVU6H5JgbA==} engines: {node: ^14.18.0 || >=16.0.0} @@ -3661,12 +3797,12 @@ packages: acorn: 8.8.0 dev: true - /acorn-jsx/5.3.2_acorn@8.8.0: + /acorn-jsx/5.3.2_acorn@8.8.1: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - acorn: 8.8.0 + acorn: 8.8.1 dev: true /acorn-walk/7.2.0: @@ -6168,21 +6304,21 @@ packages: source-map: 0.6.1 dev: true - /eslint-config-prettier/8.5.0_eslint@8.27.0: - resolution: {integrity: sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==} + /eslint-config-prettier/8.6.0_eslint@8.32.0: + resolution: {integrity: sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==} hasBin: true peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.27.0 + eslint: 8.32.0 dev: true - /eslint-plugin-cypress/2.12.1_eslint@8.27.0: + /eslint-plugin-cypress/2.12.1_eslint@8.32.0: resolution: {integrity: sha512-c2W/uPADl5kospNDihgiLc7n87t5XhUbFDoTl6CfVkmG+kDAb5Ux10V9PoLPu9N+r7znpc+iQlcmAqT1A/89HA==} peerDependencies: eslint: '>= 3.2.1' dependencies: - eslint: 8.27.0 + eslint: 8.32.0 globals: 11.12.0 dev: true @@ -6192,7 +6328,7 @@ packages: htmlparser2: 8.0.1 dev: true - /eslint-plugin-jest/27.1.5_kdswgjmqcx7mthqz7ow2zlfevy: + /eslint-plugin-jest/27.1.5_5rcd23qw3h5vuffwo2owxb3hw4: resolution: {integrity: sha512-CK2dekZ5VBdzsOSOH5Fc1rwC+cWXjkcyrmf1RV714nDUDKu+o73TTJiDxpbILG8PtPPpAAl3ywzh5QA7Ft0mjA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} peerDependencies: @@ -6205,16 +6341,16 @@ packages: jest: optional: true dependencies: - '@typescript-eslint/eslint-plugin': 5.42.1_2udltptbznfmezdozpdoa2aemq - '@typescript-eslint/utils': 5.42.1_rmayb2veg2btbq6mbmnyivgasy - eslint: 8.27.0 + '@typescript-eslint/eslint-plugin': 5.48.2_iljmjqxcygjq3saipl7gerxpvi + '@typescript-eslint/utils': 5.42.1_yygwinqv3a2io74xmwofqb7uka + eslint: 8.32.0 jest: 29.3.1_odkjkoia5xunhxkdrka32ib6vi transitivePeerDependencies: - supports-color - typescript dev: true - /eslint-plugin-jsdoc/39.6.2_eslint@8.27.0: + /eslint-plugin-jsdoc/39.6.2_eslint@8.32.0: resolution: {integrity: sha512-dvgY/W7eUFoAIIiaWHERIMI61ZWqcz9YFjEeyTzdPlrZc3TY/3aZm5aB91NUoTLWYZmO/vFlYSuQi15tF7uE5A==} engines: {node: ^14 || ^16 || ^17 || ^18 || ^19} peerDependencies: @@ -6224,7 +6360,7 @@ packages: comment-parser: 1.3.1 debug: 4.3.4 escape-string-regexp: 4.0.0 - eslint: 8.27.0 + eslint: 8.32.0 esquery: 1.4.0 semver: 7.3.8 spdx-expression-parse: 3.0.1 @@ -6240,23 +6376,23 @@ packages: vscode-json-languageservice: 4.2.1 dev: true - /eslint-plugin-lodash/7.4.0_eslint@8.27.0: + /eslint-plugin-lodash/7.4.0_eslint@8.32.0: resolution: {integrity: sha512-Tl83UwVXqe1OVeBRKUeWcfg6/pCW1GTRObbdnbEJgYwjxp5Q92MEWQaH9+dmzbRt6kvYU1Mp893E79nJiCSM8A==} engines: {node: '>=10'} peerDependencies: eslint: '>=2' dependencies: - eslint: 8.27.0 + eslint: 8.32.0 lodash: 4.17.21 dev: true - /eslint-plugin-markdown/3.0.0_eslint@8.27.0: + /eslint-plugin-markdown/3.0.0_eslint@8.32.0: resolution: {integrity: sha512-hRs5RUJGbeHDLfS7ELanT0e29Ocyssf/7kBM+p7KluY5AwngGkDf8Oyu4658/NZSGTTq05FZeWbkxXtbVyHPwg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - eslint: 8.27.0 + eslint: 8.32.0 mdast-util-from-markdown: 0.8.5 transitivePeerDependencies: - supports-color @@ -6274,7 +6410,7 @@ packages: '@microsoft/tsdoc-config': 0.16.2 dev: true - /eslint-plugin-unicorn/45.0.0_eslint@8.27.0: + /eslint-plugin-unicorn/45.0.0_eslint@8.32.0: resolution: {integrity: sha512-iP8cMRxXKHonKioOhnCoCcqVhoqhAp6rB+nsoLjXFDxTHz3btWMAp8xwzjHA0B1K6YV/U/Yvqn1bUXZt8sJPuQ==} engines: {node: '>=14.18'} peerDependencies: @@ -6283,8 +6419,8 @@ packages: '@babel/helper-validator-identifier': 7.19.1 ci-info: 3.6.2 clean-regexp: 1.0.0 - eslint: 8.27.0 - eslint-utils: 3.0.0_eslint@8.27.0 + eslint: 8.32.0 + eslint-utils: 3.0.0_eslint@8.32.0 esquery: 1.4.0 indent-string: 4.0.0 is-builtin-module: 3.2.0 @@ -6315,13 +6451,13 @@ packages: estraverse: 5.3.0 dev: true - /eslint-utils/3.0.0_eslint@8.27.0: + /eslint-utils/3.0.0_eslint@8.32.0: resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} peerDependencies: eslint: '>=5' dependencies: - eslint: 8.27.0 + eslint: 8.32.0 eslint-visitor-keys: 2.1.0 dev: true @@ -6335,13 +6471,13 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint/8.27.0: - resolution: {integrity: sha512-0y1bfG2ho7mty+SiILVf9PfuRA49ek4Nc60Wmmu62QlobNR+CeXa4xXIJgcuwSQgZiWaPH+5BDsctpIW0PR/wQ==} + /eslint/8.32.0: + resolution: {integrity: sha512-nETVXpnthqKPFyuY2FNjz/bEd6nbosRgKbkgS/y1C7LJop96gYHWpiguLecMHQ2XCPxn77DS0P+68WzG6vkZSQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint/eslintrc': 1.3.3 - '@humanwhocodes/config-array': 0.11.7 + '@eslint/eslintrc': 1.4.1 + '@humanwhocodes/config-array': 0.11.8 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 ajv: 6.12.6 @@ -6351,7 +6487,7 @@ packages: doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.1.1 - eslint-utils: 3.0.0_eslint@8.27.0 + eslint-utils: 3.0.0_eslint@8.32.0 eslint-visitor-keys: 3.3.0 espree: 9.4.0 esquery: 1.4.0 @@ -6360,7 +6496,7 @@ packages: file-entry-cache: 6.0.1 find-up: 5.0.0 glob-parent: 6.0.2 - globals: 13.17.0 + globals: 13.19.0 grapheme-splitter: 1.0.4 ignore: 5.2.0 import-fresh: 3.3.0 @@ -6387,8 +6523,8 @@ packages: resolution: {integrity: sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - acorn: 8.8.0 - acorn-jsx: 5.3.2_acorn@8.8.0 + acorn: 8.8.1 + acorn-jsx: 5.3.2_acorn@8.8.1 eslint-visitor-keys: 3.3.0 dev: true @@ -7050,8 +7186,8 @@ packages: engines: {node: '>=4'} dev: true - /globals/13.17.0: - resolution: {integrity: sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==} + /globals/13.19.0: + resolution: {integrity: sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==} engines: {node: '>=8'} dependencies: type-fest: 0.20.2 diff --git a/scripts/jison/lint.mts b/scripts/jison/lint.mts index c410d5999..95edd4fb1 100644 --- a/scripts/jison/lint.mts +++ b/scripts/jison/lint.mts @@ -23,7 +23,7 @@ const lint = async (file: string): Promise => { return result.errorCount === 0; }; -(async () => { +const main = async () => { const jisonFiles = await globby(['./packages/**/*.jison', '!./**/node_modules/**'], { dot: true, }); @@ -31,4 +31,6 @@ const lint = async (file: string): Promise => { if (lintResults.includes(false)) { process.exit(1); } -})(); +}; + +void main(); diff --git a/tests/webpack/src/index.js b/tests/webpack/src/index.js index 899f66596..092972694 100644 --- a/tests/webpack/src/index.js +++ b/tests/webpack/src/index.js @@ -13,8 +13,8 @@ const load = async () => { await mermaid.registerExternalDiagrams([mindmap]); await render('info'); - setTimeout(async () => { - await render(`mindmap + setTimeout(() => { + void render(`mindmap root((mindmap)) Origins Long history @@ -35,4 +35,4 @@ const load = async () => { }, 2500); }; -window.addEventListener('load', load, false); +window.addEventListener('load', () => void load(), false); diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json new file mode 100644 index 000000000..5090f49d1 --- /dev/null +++ b/tsconfig.eslint.json @@ -0,0 +1,9 @@ +{ + // extend your base config to share compilerOptions, etc + "extends": "./tsconfig.json", + "compilerOptions": { + // ensure that nobody can accidentally use this config for a build + "noEmit": true + }, + "include": ["packages", "tests", "scripts", "cypress", "__mocks__", "./.eslintrc.cjs", "./*"] +}