From 3a56bbed2e3c4e06ffa7fb76ac9d456774fca9fe Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Wed, 11 May 2022 02:52:55 +0200 Subject: [PATCH] build: setup eslint-plugin-json (#2552) Co-authored-by: Yash Singh --- .eslintignore | 1 + .eslintrc.json | 5 +- .gitattributes | 1 + .lintstagedrc.json | 2 +- docs/classDiagram.md | 17 ++---- docs/development.md | 3 +- .../flowchart.md | 19 ++----- docs/flowchart.md | 19 ++----- docs/gantt.md | 14 ++--- package.json | 5 +- yarn.lock | 52 +++++++++++++++++-- 11 files changed, 71 insertions(+), 67 deletions(-) create mode 100644 .gitattributes diff --git a/.eslintignore b/.eslintignore index a11511b7c..9d8891de0 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ dist/** .github/** +docs/Setup.md diff --git a/.eslintrc.json b/.eslintrc.json index fe19a4534..ef7c2d3c7 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": "off", "no-unused-vars": "off", @@ -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 000000000..176a458f9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/.lintstagedrc.json b/.lintstagedrc.json index f42adf44f..555f78ddb 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/docs/classDiagram.md b/docs/classDiagram.md index ba5391709..4877b10ab 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/development.md b/docs/development.md index a152a5b6c..fbc687e81 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? diff --git a/docs/diagrams-and-syntax-and-examples/flowchart.md b/docs/diagrams-and-syntax-and-examples/flowchart.md index bca9113c6..b595610ff 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 485686995..967914417 100644 --- a/docs/flowchart.md +++ b/docs/flowchart.md @@ -435,9 +435,7 @@ Examples of tooltip usage below: ```html ``` @@ -486,19 +484,8 @@ Beginners tip, a full example using interactive links in a html context: diff --git a/docs/gantt.md b/docs/gantt.md index 952288534..3d8fdbb3b 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/package.json b/package.json index 6b2722c72..c3255840a 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,.md", "lint:fix": "yarn lint --fix", "e2e:depr": "yarn lint && jest e2e --config e2e/jest.config.js", "cypress": "cypress run", @@ -84,12 +84,13 @@ "cypress": "9.6.0", "cypress-image-snapshot": "^4.0.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": "^26.0.0", "eslint-plugin-jsdoc": "^39.1.0", + "eslint-plugin-json": "^3.1.0", "eslint-plugin-markdown": "^2.2.1", "eslint-plugin-prettier": "^4.0.0", "husky": "^8.0.0", diff --git a/yarn.lock b/yarn.lock index e93c22dad..4d092211c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5545,6 +5545,14 @@ eslint-plugin-jsdoc@^39.1.0: semver "^7.3.7" 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" @@ -5592,10 +5600,10 @@ eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.3.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint@^8.2.0: - version "8.15.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.15.0.tgz#fea1d55a7062da48d82600d2e0974c55612a11e9" - integrity sha512-GG5USZ1jhCu8HJkzGgeK8/+RGnHaNYZGrGDzUtigK3BsGESW/rs2az23XqE0WVwDxy1VRvvjSSGu5nB0Bu+6SA== +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== dependencies: "@eslint/eslintrc" "^1.2.3" "@humanwhocodes/config-array" "^0.9.2" @@ -7927,6 +7935,11 @@ json5@^2.1.2, json5@^2.2.1: resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== +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" @@ -11858,6 +11871,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"