From c5b7ca4fcda22971cc1b12d04c6405cbfaadc5e2 Mon Sep 17 00:00:00 2001 From: MOREL Matthieu Date: Sat, 11 Dec 2021 13:12:45 +0100 Subject: [PATCH 1/5] build: setup eslint-plugin-json --- .eslintrc.json | 4 ++-- .lintstagedrc.json | 2 +- package.json | 5 +++-- yarn.lock | 46 +++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 51 insertions(+), 6 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 7f25c4ec73..b99407253d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -13,8 +13,8 @@ }, "sourceType": "module" }, - "extends": ["eslint:recommended", "plugin:jsdoc/recommended", "plugin:markdown/recommended", "plugin:prettier/recommended"], - "plugins": ["html", "jest", "jsdoc", "prettier"], + "extends": ["eslint:recommended", "plugin:jsdoc/recommended", "plugin:json/recommended", "plugin:markdown/recommended", "plugin:prettier/recommended"], + "plugins": ["html", "jest", "jsdoc", "json", "prettier"], "rules": { "no-prototype-builtins": 0, "no-unused-vars": 0, diff --git a/.lintstagedrc.json b/.lintstagedrc.json index f42adf44f9..555f78ddbb 100644 --- a/.lintstagedrc.json +++ b/.lintstagedrc.json @@ -1,5 +1,5 @@ { - "*.{js,html,md}": [ + "*.{js,json,html,md}": [ "yarn lint:fix" ] } \ No newline at end of file diff --git a/package.json b/package.json index 9dce5af107..401aa5dc71 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "postbuild": "documentation build src/mermaidAPI.js src/config.js src/defaultConfig.js --shallow -f md --markdown-toc false > docs/Setup.md", "build:watch": "yarn build:development --watch", "release": "yarn build", - "lint": "eslint ./ --ext js,html", + "lint": "eslint ./ --ext .js,.json,.html", "lint:fix": "yarn lint --fix", "e2e:depr": "yarn lint && jest e2e --config e2e/jest.config.js", "cypress": "percy exec -- cypress run", @@ -84,12 +84,13 @@ "css-to-string-loader": "^0.1.3", "cypress": "9.1.1", "documentation": "13.2.0", - "eslint": "^8.2.0", + "eslint": "^8.4.1", "eslint-config-prettier": "^8.3.0", "eslint-plugin-cypress": "^2.12.1", "eslint-plugin-html": "^6.2.0", "eslint-plugin-jest": "^25.2.4", "eslint-plugin-jsdoc": "^37.0.3", + "eslint-plugin-json": "^3.1.0", "eslint-plugin-markdown": "^2.2.1", "eslint-plugin-prettier": "^4.0.0", "husky": "^7.0.1", diff --git a/yarn.lock b/yarn.lock index eaa22263f8..9754499705 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4960,6 +4960,14 @@ eslint-plugin-jsdoc@^37.0.3: semver "^7.3.5" spdx-expression-parse "^3.0.1" +eslint-plugin-json@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-json/-/eslint-plugin-json-3.1.0.tgz#251108ba1681c332e0a442ef9513bd293619de67" + integrity sha512-MrlG2ynFEHe7wDGwbUuFPsaT2b1uhuEFhJ+W1f1u+1C2EkXmTYJp4B1aAdQQ8M+CC3t//N/oRKiIVw14L2HR1g== + dependencies: + lodash "^4.17.21" + vscode-json-languageservice "^4.1.6" + eslint-plugin-markdown@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/eslint-plugin-markdown/-/eslint-plugin-markdown-2.2.1.tgz#76b8a970099fbffc6cc1ffcad9772b96911c027a" @@ -5007,7 +5015,7 @@ eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.1.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.1.0.tgz#eee4acea891814cda67a7d8812d9647dd0179af2" integrity sha512-yWJFpu4DtjsWKkt5GeNBBuZMlNcYVs6vRCLoCVEJrTjaSB6LC98gFipNK/erM2Heg/E8mIK+hXG/pJMLK+eRZA== -eslint@^8.2.0: +eslint@^8.4.1: version "8.4.1" resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.4.1.tgz#d6531bbf3e598dffd7c0c7d35ec52a0b30fdfa2d" integrity sha512-TxU/p7LB1KxQ6+7aztTnO7K0i+h0tDi81YRY9VzB6Id71kNz+fFYnf5HD5UOQmxkzcoa0TlVZf9dpMtUv0GpWg== @@ -7333,6 +7341,11 @@ json5@^2.1.2: dependencies: minimist "^1.2.5" +jsonc-parser@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.0.0.tgz#abdd785701c7e7eaca8a9ec8cf070ca51a745a22" + integrity sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA== + jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" @@ -10838,6 +10851,37 @@ vinyl@^2.0.0, vinyl@^2.1.0: remove-trailing-separator "^1.0.1" replace-ext "^1.0.0" +vscode-json-languageservice@^4.1.6: + version "4.1.10" + resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-4.1.10.tgz#5d5729fc4f3e02f41599e0104523a1877c25f0fb" + integrity sha512-IHliMEEYSY0tJjJt0ECb8ESx/nRXpoy9kN42WVQXgaqGyizFAf3jibSiezDQTrrY7f3kywXggCU+kkJEM+OLZQ== + dependencies: + jsonc-parser "^3.0.0" + vscode-languageserver-textdocument "^1.0.1" + vscode-languageserver-types "^3.16.0" + vscode-nls "^5.0.0" + vscode-uri "^3.0.2" + +vscode-languageserver-textdocument@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.3.tgz#879f2649bfa5a6e07bc8b392c23ede2dfbf43eff" + integrity sha512-ynEGytvgTb6HVSUwPJIAZgiHQmPCx8bZ8w5um5Lz+q5DjP0Zj8wTFhQpyg8xaMvefDytw2+HH5yzqS+FhsR28A== + +vscode-languageserver-types@^3.16.0: + version "3.16.0" + resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz#ecf393fc121ec6974b2da3efb3155644c514e247" + integrity sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA== + +vscode-nls@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840" + integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA== + +vscode-uri@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.2.tgz#ecfd1d066cb8ef4c3a208decdbab9a8c23d055d0" + integrity sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA== + vue-template-compiler@^2.5.16: version "2.6.14" resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.6.14.tgz#a2f0e7d985670d42c9c9ee0d044fed7690f4f763" From 52486f30ecaf2a4a5c74556ac1cf93cb0e2c7515 Mon Sep 17 00:00:00 2001 From: Yash Singh Date: Mon, 27 Dec 2021 13:28:56 -0800 Subject: [PATCH 2/5] Lint md files too --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 401aa5dc71..c2906544d8 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "postbuild": "documentation build src/mermaidAPI.js src/config.js src/defaultConfig.js --shallow -f md --markdown-toc false > docs/Setup.md", "build:watch": "yarn build:development --watch", "release": "yarn build", - "lint": "eslint ./ --ext .js,.json,.html", + "lint": "eslint ./ --ext .js,.json,.html,.md", "lint:fix": "yarn lint --fix", "e2e:depr": "yarn lint && jest e2e --config e2e/jest.config.js", "cypress": "percy exec -- cypress run", From c8821f6311bc7eee0a33200705fa3c6a35caa711 Mon Sep 17 00:00:00 2001 From: Yash-Singh1 Date: Tue, 28 Dec 2021 14:38:26 -0800 Subject: [PATCH 3/5] chore: fix md lint warnings --- docs/README.md | 3 +- docs/Setup.md | 65 +++---------------- docs/classDiagram.md | 17 ++--- .../flowchart.md | 19 +----- docs/flowchart.md | 19 +----- docs/gantt.md | 14 +--- docs/sequenceDiagram.md | 4 +- docs/usage.md | 32 +++------ 8 files changed, 35 insertions(+), 138 deletions(-) diff --git a/docs/README.md b/docs/README.md index 63ece825e4..326ca1ce4a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -197,7 +197,8 @@ To Deploy Mermaid: ```html - + ``` **Doing so will command the mermaid parser to look for the `
` tags with `class="mermaid"`. From these tags mermaid will try to read the diagram/chart definitions and render them into svg charts.** diff --git a/docs/Setup.md b/docs/Setup.md index 70e7fdaeb3..0069a00e57 100644 --- a/docs/Setup.md +++ b/docs/Setup.md @@ -1069,61 +1069,16 @@ Returns **any** ```html ``` diff --git a/docs/classDiagram.md b/docs/classDiagram.md index c03adca6df..08bf900899 100644 --- a/docs/classDiagram.md +++ b/docs/classDiagram.md @@ -402,10 +402,8 @@ click Shape2 call callbackFunction() "This is a tooltip for a callback" ```html ``` ```mermaid @@ -454,15 +452,8 @@ Beginners tip, a full example using interactive links in an html context:
``` diff --git a/docs/diagrams-and-syntax-and-examples/flowchart.md b/docs/diagrams-and-syntax-and-examples/flowchart.md index 843da5ab19..ac6c5e4a05 100644 --- a/docs/diagrams-and-syntax-and-examples/flowchart.md +++ b/docs/diagrams-and-syntax-and-examples/flowchart.md @@ -414,9 +414,7 @@ Examples of tooltip usage below: ```html ``` @@ -464,19 +462,8 @@ Beginners tip, a full example using interactive links in a html context: diff --git a/docs/flowchart.md b/docs/flowchart.md index 2868008d3a..6f1708829c 100644 --- a/docs/flowchart.md +++ b/docs/flowchart.md @@ -428,9 +428,7 @@ Examples of tooltip usage below: ```html ``` @@ -479,19 +477,8 @@ Beginners tip, a full example using interactive links in a html context: diff --git a/docs/gantt.md b/docs/gantt.md index 5e4e195353..4ef99de2b6 100644 --- a/docs/gantt.md +++ b/docs/gantt.md @@ -331,17 +331,9 @@ Beginners tip, a full example using interactive links in an html context: ``` diff --git a/docs/sequenceDiagram.md b/docs/sequenceDiagram.md index 0d342f2f11..fc0eaa3520 100644 --- a/docs/sequenceDiagram.md +++ b/docs/sequenceDiagram.md @@ -308,9 +308,7 @@ It is possible to get a sequence number attached to each arrow in a sequence dia ```html ``` diff --git a/docs/usage.md b/docs/usage.md index 3b9138d8ff..4db4d73ab6 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -50,7 +50,8 @@ The easiest way to integrate mermaid on a web page requires three elements: 2. The `mermaidAPI` call, in a separate `script` tag. Example: ```html - + ``` 3. A graph definition, inside `
` tags labeled `class=mermaid`. Example: @@ -82,7 +83,8 @@ locate the graph definitions inside the `div` tags with `class="mermaid"` and re B-->D(fa:fa-spinner);
- + ``` @@ -203,20 +205,10 @@ The example below show an outline of how this could be used. The example just lo ``` @@ -345,13 +337,7 @@ on what kind of integration you use. ```html ``` From 045377e1ad5ba538062d9fcab0c19c66fef72103 Mon Sep 17 00:00:00 2001 From: Yash-Singh1 Date: Tue, 28 Dec 2021 15:22:00 -0800 Subject: [PATCH 4/5] chore: ignore Setup.md as it is autogenerated --- .eslintignore | 1 + docs/Setup.md | 65 +++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 56 insertions(+), 10 deletions(-) diff --git a/.eslintignore b/.eslintignore index a11511b7ca..9d8891de0f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ dist/** .github/** +docs/Setup.md diff --git a/docs/Setup.md b/docs/Setup.md index 0069a00e57..70e7fdaeb3 100644 --- a/docs/Setup.md +++ b/docs/Setup.md @@ -1069,16 +1069,61 @@ Returns **any** ```html ``` From df12d58a504c446a6725012c129e759be8e4cbc1 Mon Sep 17 00:00:00 2001 From: Yash-Singh1 Date: Tue, 10 May 2022 17:49:27 -0700 Subject: [PATCH 5/5] chore: enable rules --- .eslintrc.json | 1 + .gitattributes | 1 + docs/development.md | 3 +-- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 .gitattributes diff --git a/.eslintrc.json b/.eslintrc.json index c32e7f7cd3..ef7c2d3c75 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -25,6 +25,7 @@ "jsdoc/newline-after-description": "off", "jsdoc/tag-lines": "off", "cypress/no-async-tests": "off", + "json/*": ["error", "allowComments"], "no-empty": ["error", { "allowEmptyCatch": true }] }, "overrides": [ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..176a458f94 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/docs/development.md b/docs/development.md index a152a5b6cc..fbc687e815 100644 --- a/docs/development.md +++ b/docs/development.md @@ -97,8 +97,7 @@ it('should render forks and joins', () => { { logLevel: 0 } ); cy.get('svg'); -}); - +}); ``` ### Any Questions or Suggestions?