From f2698c2ca8fb3bf9c047eeee91630cd6db292972 Mon Sep 17 00:00:00 2001 From: jfh Date: Sun, 25 Oct 2020 17:54:04 +0100 Subject: [PATCH] npm update with fix to new eslint issues --- badges/coverage-badge.svg | 2 +- package-lock.json | 180 ++++++++++-------- package.json | 22 +-- src/common/svgtransformlist.js | 6 +- src/common/utilities.js | 16 +- .../extensions/ext-arrows/ext-arrows.js | 6 +- .../extensions/ext-markers/ext-markers.js | 5 +- src/editor/jgraduate/jQuery.jPicker.js | 2 +- src/editor/svgedit.js | 41 +--- src/editor/svgicons/jQuery.svgIcons.js | 11 +- src/svgcanvas/path.js | 19 +- src/svgcanvas/recalculate.js | 8 +- src/svgcanvas/svgcanvas.js | 28 +-- 13 files changed, 151 insertions(+), 195 deletions(-) diff --git a/badges/coverage-badge.svg b/badges/coverage-badge.svg index 3bed2c32..b6850018 100644 --- a/badges/coverage-badge.svg +++ b/badges/coverage-badge.svg @@ -1 +1 @@ -Statements 51.11%Statements 51.11%Branches 40.85%Branches 40.85%Lines 51.82%Lines 51.82%Functions 58.62%Functions 58.62% +Statements 51.21%Statements 51.21%Branches 40.94%Branches 40.94%Lines 51.94%Lines 51.94%Functions 58.24%Functions 58.24% diff --git a/package-lock.json b/package-lock.json index f269d795..260f9d94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1966,6 +1966,7 @@ "version": "7.11.2", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.11.2.tgz", "integrity": "sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==", + "dev": true, "requires": { "regenerator-runtime": "^0.13.4" } @@ -1974,7 +1975,6 @@ "version": "7.12.1", "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.12.1.tgz", "integrity": "sha512-umhPIcMrlBZ2aTWlWjUseW9LjQKxi1dpFlQS8DzsxB//5K+u6GLTC/JliPKHsd5kJVPIU6X/Hy0YvWOYPcMxBw==", - "dev": true, "requires": { "core-js-pure": "^3.0.0", "regenerator-runtime": "^0.13.4" @@ -2043,9 +2043,9 @@ "dev": true }, "@cypress/browserify-preprocessor": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@cypress/browserify-preprocessor/-/browserify-preprocessor-3.0.0.tgz", - "integrity": "sha512-8CXLCKlXVUnad5TjwVswq4nwwWVyt5Z+HMgrFaD2yF7A62AA6OYDrShTQnG6M6+hr1cq1X4zYbo7VT4oxex5hA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@cypress/browserify-preprocessor/-/browserify-preprocessor-3.0.1.tgz", + "integrity": "sha512-sErmFSEr5287bLMRl0POGnyFtJCs/lSk5yxrUIJUIHZ8eDvtTEr0V93xRgLjJVG54gJU4MbpHy1mRPA9VZbtQA==", "dev": true, "requires": { "@babel/core": "7.4.5", @@ -2167,14 +2167,25 @@ }, "dependencies": { "@babel/plugin-proposal-object-rest-spread": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.11.0.tgz", - "integrity": "sha512-wzch41N4yztwoRw0ak+37wxwJM2oiIiy6huGCoqkvSTA9acYWcPfn9Y4aJqmFFJ70KTJUu29f3DQ43uJ9HXzEA==", + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.12.1.tgz", + "integrity": "sha512-s6SowJIjzlhx8o7lsFx5zmY4At6CTtDvgNQDdPzkBQucle58A6b/TTeEBYtyDgmcXjUTM+vE8YOGHZzzbc/ioA==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.10.4", "@babel/plugin-syntax-object-rest-spread": "^7.8.0", - "@babel/plugin-transform-parameters": "^7.10.4" + "@babel/plugin-transform-parameters": "^7.12.1" + }, + "dependencies": { + "@babel/plugin-transform-parameters": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.12.1.tgz", + "integrity": "sha512-xq9C5EQhdPK23ZeCdMxl8bbRnAgHFrw5EOC3KJUsSylZqdkCaFEXxGSBuTSObOpiiHHNyb82es8M1QYgfQGfNg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + } } } } @@ -2188,12 +2199,6 @@ "regenerator-runtime": "^0.12.0" } }, - "coffeescript": { - "version": "1.12.7", - "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-1.12.7.tgz", - "integrity": "sha512-pLXHFxQMPklVoEekowk8b3erNynC+DVJzChxS/LCBBgR6/8AJkHivkm//zbowcfc7BTCAjryuhx6gPqPRfsFoA==", - "dev": true - }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -2230,27 +2235,44 @@ } }, "@cypress/code-coverage": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/@cypress/code-coverage/-/code-coverage-3.8.1.tgz", - "integrity": "sha512-XkecqM/4xHZdAPUMOxOUi5yf2TDWUycqIi6Z6zdGiO9j04CxkRoVTOJYsE14i7uG7orudYSLcLFJEeJv237qXQ==", + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/@cypress/code-coverage/-/code-coverage-3.8.2.tgz", + "integrity": "sha512-wgzUxWAbsMJVyxnfyqF0VcyDXz38mnWpTpEnr+DFugKnDF7CQ9uwmvnGX1KN4d8kIGT9WpwaycJaLMwIStB+yw==", "dev": true, "requires": { - "@cypress/browserify-preprocessor": "3.0.0", - "debug": "4.1.1", - "execa": "4.0.2", - "globby": "11.0.0", + "@cypress/browserify-preprocessor": "3.0.1", + "debug": "4.2.0", + "execa": "4.0.3", + "globby": "11.0.1", "istanbul-lib-coverage": "3.0.0", "js-yaml": "3.14.0", "nyc": "15.1.0" }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", "dev": true, "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" + } + }, + "execa": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/execa/-/execa-4.0.3.tgz", + "integrity": "sha512-WFDXGHckXPWZX19t1kCsXzOpqX9LWYNqn4C+HqZlk/V0imTkzJZqf87ZBhvpHaftERYknpk0fjSylnXVlVgI0A==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" } }, "ms": { @@ -2584,9 +2606,9 @@ } }, "@eslint/eslintrc": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.1.3.tgz", - "integrity": "sha512-4YVwPkANLeNtRjMekzux1ci8hIaH5eGKktGqR0d3LWsKNn5B2X/1Z6Trxy7jQXl9EBGE6Yj02O+t09FMeRllaA==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.2.0.tgz", + "integrity": "sha512-+cIGPCBdLCzqxdtwppswP+zTsH9BOIGzAeKfBIbtb4gW/giMlfMwP0HUSFfhzh20f9u8uZ8hOp62+4GPquTbwQ==", "dev": true, "requires": { "ajv": "^6.12.4", @@ -6807,16 +6829,16 @@ "dev": true }, "canvg": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/canvg/-/canvg-3.0.6.tgz", - "integrity": "sha512-eFUy8R/4DgocR93LF8lr+YUxW4PYblUe/Q1gz2osk/cI5n8AsYdassvln0D9QPhLXQ6Lx7l8hwtT8FLvOn2Ihg==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/canvg/-/canvg-3.0.7.tgz", + "integrity": "sha512-4sq6iL5Q4VOXS3PL1BapiXIZItpxYyANVzsAKpTPS5oq4u3SKbGfUcbZh2gdLCQ3jWpG/y5wRkMlBBAJhXeiZA==", "requires": { - "@babel/runtime": "^7.6.3", + "@babel/runtime-corejs3": "^7.9.6", "@types/raf": "^3.4.0", - "core-js": "3", "raf": "^3.4.1", "rgbcolor": "^1.0.1", - "stackblur-canvas": "^2.0.0" + "stackblur-canvas": "^2.0.0", + "svg-pathdata": "^5.0.5" } }, "caseless": { @@ -7515,8 +7537,7 @@ "core-js-pure": { "version": "3.6.5", "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.6.5.tgz", - "integrity": "sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA==", - "dev": true + "integrity": "sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA==" }, "core-util-is": { "version": "1.0.2", @@ -9536,13 +9557,13 @@ } }, "eslint": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.11.0.tgz", - "integrity": "sha512-G9+qtYVCHaDi1ZuWzBsOWo2wSwd70TXnU6UHA3cTYHp7gCTXZcpggWFoUVAMRarg68qtPoNfFbzPh+VdOgmwmw==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.12.0.tgz", + "integrity": "sha512-n5pEU27DRxCSlOhJ2rO57GDLcNsxO0LPpAbpFdh7xmcDmjmlGUfoyrsB3I7yYdQXO5N3gkSTiDrPSPNFiiirXA==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@eslint/eslintrc": "^0.1.3", + "@eslint/eslintrc": "^0.2.0", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -9823,15 +9844,15 @@ } }, "eslint-config-ash-nazg": { - "version": "22.8.0", - "resolved": "https://registry.npmjs.org/eslint-config-ash-nazg/-/eslint-config-ash-nazg-22.8.0.tgz", - "integrity": "sha512-MKl2kW6cbH28nMs9MAGcg10PB3YGpUenYLpbHKBpCNa1jjN3Q/SHQTm0VDgHO7KyczJjmLpZDN8rfRpmegbVsQ==", + "version": "22.9.0", + "resolved": "https://registry.npmjs.org/eslint-config-ash-nazg/-/eslint-config-ash-nazg-22.9.0.tgz", + "integrity": "sha512-jlU9E06xrAdxHgM+nQLAKhH2QvpmFM7JVb7w4i7T4r0zNBsBk1nWEJbmD6b6mJN01S7dlO7QaOcLzymGKg+Alw==", "dev": true }, "eslint-config-standard": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-14.1.1.tgz", - "integrity": "sha512-Z9B+VR+JIXRxz21udPTL9HpFMyoMUEeX1G251EQ6e05WD9aPVtVBn09XUmZ259wCMlCDmYDSZG62Hhm+ZTJcUg==", + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-15.0.0.tgz", + "integrity": "sha512-MZ8KRhUJLtMbjQo9PsEzFG29vqbQJfLoLBHrTaAaFMtDx9PIm1GZgyUanOLgf1xOE1aWrtZZSbxBYCy8dJCCBg==", "dev": true }, "eslint-import-resolver-node": { @@ -10082,9 +10103,9 @@ } }, "eslint-plugin-jsdoc": { - "version": "30.6.5", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.6.5.tgz", - "integrity": "sha512-obC3wi1/b5hsPLXa3ZDs571QXGqkVsphndMsIsVQzWRdZOaRbxdvGiKhLzzZytbRZAL1M1Bkdc/3Af7eNxJ/Hg==", + "version": "30.7.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.7.3.tgz", + "integrity": "sha512-slzJeKrm3vXabRYcFBpbUgWgdnATN9rNOFAr7IhmkxmR9Vk/6qN1c/IdvTqVSEctDRQ08chR+Lvk8fRayXgYZg==", "dev": true, "requires": { "comment-parser": "^0.7.6", @@ -10164,9 +10185,9 @@ } }, "eslint-plugin-mocha-cleanup": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-mocha-cleanup/-/eslint-plugin-mocha-cleanup-1.8.0.tgz", - "integrity": "sha512-LvnHn1FPz9NdMcORRl9sytr/chV99KPMEBzqc9QIqVJvy+93BhtFjq135kKrnVW4Re8QHJNZpkC4QakuvQ3qbg==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-mocha-cleanup/-/eslint-plugin-mocha-cleanup-1.9.1.tgz", + "integrity": "sha512-pRlkXdEy9kDvOT1bG6IdOWX95Ykco2rUPVRZ8wEeU81NbQCUaI+qrMcD64PnOJFSw498jyST2919a2+KsbPXZw==", "dev": true, "requires": { "requireindex": "~1.2.0" @@ -10259,15 +10280,15 @@ "dev": true }, "eslint-plugin-standard": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.0.1.tgz", - "integrity": "sha512-v/KBnfyaOMPmZc/dmc6ozOdWqekGp7bBGq4jLAecEfPGmfKiWS4sA8sC0LqiV9w5qmXAtXVn4M3p1jSyhY85SQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.0.2.tgz", + "integrity": "sha512-nKptN8l7jksXkwFk++PhJB3cCDTcXOEyhISIN86Ue2feJ1LFyY3PrY3/xT2keXlJSY5bpmbiTG0f885/YKAvTA==", "dev": true }, "eslint-plugin-unicorn": { - "version": "22.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-22.0.0.tgz", - "integrity": "sha512-jXPOauNiVFYLr+AeU3l21Ao+iDl/G08vUWui21RCI2L1TJIIoJvAMjMR6I+QPKr8FgIumzuR6gzDKCtEx2IkzA==", + "version": "23.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-23.0.0.tgz", + "integrity": "sha512-Vabo3cjl6cjyhcf+76CdQEY6suOFzK0Xh3xo0uL9VDYrDJP5+B6PjV0tHTYm82WZmFWniugFJM3ywHSNYTi/ZQ==", "dev": true, "requires": { "ci-info": "^2.0.0", @@ -11437,9 +11458,9 @@ "dev": true }, "globby": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.0.tgz", - "integrity": "sha512-iuehFnR3xu5wBBtm4xi0dMe92Ob87ufyu/dHwpDYfbcpYpIbrO5OnS8M1vWvrBhSGEJ3/Ecj7gnX76P8YxpPEg==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.1.tgz", + "integrity": "sha512-iH9RmgwCmUJHi2z5o2l3eTtGBtXek1OYlHrbcxOYugyHLmAsZrPj43OtHThd62Buh/Vv6VyCBD2bdyWcGNQqoQ==", "dev": true, "requires": { "array-union": "^2.1.0", @@ -11448,14 +11469,6 @@ "ignore": "^5.1.4", "merge2": "^1.3.0", "slash": "^3.0.0" - }, - "dependencies": { - "slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true - } } }, "got": { @@ -13835,9 +13848,9 @@ } }, "lint-staged": { - "version": "10.4.1", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-10.4.1.tgz", - "integrity": "sha512-E2Y6Mu1haUD3ZefzwBG8tqy3QDQ9udWRS946YcuDCU8Mi22RjwxrEhLrqTLszxl80DG/sCtKdGCArzEkTsBzJQ==", + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-10.4.2.tgz", + "integrity": "sha512-OLCA9K1hS+Sl179SO6kX0JtnsaKj/MZalEhUj5yAgXsb63qPI/Gfn6Ua1KuZdbfkZNEu3/n5C/obYCu70IMt9g==", "dev": true, "requires": { "chalk": "^4.1.0", @@ -13917,9 +13930,9 @@ "dev": true }, "commander": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.1.0.tgz", - "integrity": "sha512-wl7PNrYWd2y5mp1OK/LhTlv8Ff4kQJQRXXAvF+uU/TPNiVJUxZLRYGj/B0y/lPGAVcSbJqH2Za/cvHmrPMC8mA==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.0.tgz", + "integrity": "sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==", "dev": true }, "cosmiconfig": { @@ -19036,9 +19049,9 @@ } }, "rollup": { - "version": "2.32.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.32.0.tgz", - "integrity": "sha512-0FIG1jY88uhCP2yP4CfvtKEqPDRmsUwfY1kEOOM+DH/KOGATgaIFd/is1+fQOxsvh62ELzcFfKonwKWnHhrqmw==", + "version": "2.32.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.32.1.tgz", + "integrity": "sha512-Op2vWTpvK7t6/Qnm1TTh7VjEZZkN8RWgf0DHbkKzQBwNf748YhXbozHVefqpPp/Fuyk/PQPAnYsBxAEtlMvpUw==", "dev": true, "requires": { "fsevents": "~2.1.2" @@ -19496,6 +19509,12 @@ "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", "dev": true }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, "slice-ansi": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", @@ -20293,6 +20312,11 @@ "has-flag": "^3.0.0" } }, + "svg-pathdata": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/svg-pathdata/-/svg-pathdata-5.0.5.tgz", + "integrity": "sha512-TAAvLNSE3fEhyl/Da19JWfMAdhSXTYeviXsLSoDT1UM76ADj5ndwAPX1FKQEgB/gFMPavOy6tOqfalXKUiXrow==" + }, "svg2pdf.js": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/svg2pdf.js/-/svg2pdf.js-2.0.0.tgz", diff --git a/package.json b/package.json index 51f7dd61..d40ec3fb 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,7 @@ ], "dependencies": { "@babel/polyfill": "^7.12.1", - "canvg": "^3.0.6", + "canvg": "^3.0.7", "core-js": "^3.6.5", "jspdf": "^2.1.1", "pathseg": "^1.2.0", @@ -147,7 +147,7 @@ "@babel/preset-env": "^7.12.1", "@babel/register": "^7.12.1", "@babel/runtime-corejs3": "^7.12.1", - "@cypress/code-coverage": "^3.8.1", + "@cypress/code-coverage": "^3.8.2", "@cypress/fiddle": "^1.18.3", "@fintechstudios/eslint-plugin-chai-as-promised": "^3.0.2", "@hkdobrev/run-if-changed": "^0.3.1", @@ -172,9 +172,9 @@ "es-dev-commonjs-transformer": "^0.2.0", "es-dev-server": "^1.57.8", "es-dev-server-rollup": "0.0.8", - "eslint": "^7.11.0", - "eslint-config-ash-nazg": "^22.8.0", - "eslint-config-standard": "^14.1.1", + "eslint": "^7.12.0", + "eslint-config-ash-nazg": "^22.9.0", + "eslint-config-standard": "^15.0.0", "eslint-plugin-array-func": "^3.1.7", "eslint-plugin-chai-expect": "^2.2.0", "eslint-plugin-chai-expect-keywords": "^2.0.1", @@ -184,23 +184,23 @@ "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-html": "^6.1.0", "eslint-plugin-import": "^2.22.1", - "eslint-plugin-jsdoc": "^30.6.5", + "eslint-plugin-jsdoc": "^30.7.3", "eslint-plugin-markdown": "^1.0.2", "eslint-plugin-mocha": "^8.0.0", - "eslint-plugin-mocha-cleanup": "^1.8.0", + "eslint-plugin-mocha-cleanup": "^1.9.1", "eslint-plugin-no-unsanitized": "^3.1.4", "eslint-plugin-no-use-extend-native": "^0.5.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^4.2.1", "eslint-plugin-sonarjs": "^0.5.0", - "eslint-plugin-standard": "^4.0.1", - "eslint-plugin-unicorn": "^22.0.0", + "eslint-plugin-standard": "^4.0.2", + "eslint-plugin-unicorn": "^23.0.0", "husky": "^4.3.0", "imageoptim-cli": "^3.0.2", "jamilih": "^0.53.2", "jsdoc": "^3.6.6", "license-badger": "^0.18.0", - "lint-staged": "^10.4.1", + "lint-staged": "^10.4.2", "mocha": "^8.2.0", "mocha-badge-generator": "^0.8.0", "mochawesome": "^6.1.1", @@ -217,7 +217,7 @@ "remark-lint-ordered-list-marker-value": "^2.0.1", "requirejs": "^2.3.6", "rimraf": "^3.0.2", - "rollup": "2.32.0", + "rollup": "2.32.1", "rollup-plugin-copy": "^3.3.0", "rollup-plugin-filesize": "^9.0.2", "rollup-plugin-node-polyfills": "^0.2.1", diff --git a/src/common/svgtransformlist.js b/src/common/svgtransformlist.js index 09d5eae6..e5719c23 100644 --- a/src/common/svgtransformlist.js +++ b/src/common/svgtransformlist.js @@ -28,11 +28,7 @@ function transformToString (xform) { text = 'translate(' + m.e + ',' + m.f + ')'; break; case 3: // SCALE - if (m.a === m.d) { - text = 'scale(' + m.a + ')'; - } else { - text = 'scale(' + m.a + ',' + m.d + ')'; - } + text = (m.a === m.d) ? `scale(${m.a})` : `scale(${m.a},${m.d})`; break; case 4: { // ROTATE let cx = 0; diff --git a/src/common/utilities.js b/src/common/utilities.js index 21681526..253743e7 100644 --- a/src/common/utilities.js +++ b/src/common/utilities.js @@ -315,11 +315,7 @@ export const convertToXMLReferences = function (input) { let output = ''; [...input].forEach((ch) => { const c = ch.charCodeAt(); - if (c <= 127) { - output += ch; - } else { - output += `&#${c};`; - } + output += (c <= 127) ? ch : `&#${c};`; }); return output; }; @@ -778,18 +774,17 @@ export const getPathDFromElement = function (elem) { h = b.height; num = 4 - num; // Why? Because! - if (!rx && !ry) { + d = (!rx && !ry) // Regular rect - d = getPathDFromSegments([ + ? getPathDFromSegments([ ['M', [x, y]], ['L', [x + w, y]], ['L', [x + w, y + h]], ['L', [x, y + h]], ['L', [x, y]], ['Z', []] - ]); - } else { - d = getPathDFromSegments([ + ]) + : getPathDFromSegments([ ['M', [x, y + ry]], ['C', [x, y + ry / num, x + rx / num, y, x + rx, y]], ['L', [x + w - rx, y]], @@ -801,7 +796,6 @@ export const getPathDFromElement = function (elem) { ['L', [x, y + ry]], ['Z', []] ]); - } break; } default: break; diff --git a/src/editor/extensions/ext-arrows/ext-arrows.js b/src/editor/extensions/ext-arrows/ext-arrows.js index b5351143..c7e69c00 100644 --- a/src/editor/extensions/ext-arrows/ext-arrows.js +++ b/src/editor/extensions/ext-arrows/ext-arrows.js @@ -58,11 +58,7 @@ export default { svgCanvas.bind('setnonce', setArrowNonce); svgCanvas.bind('unsetnonce', unsetArrowNonce); - if (randomizeIds) { - arrowprefix = prefix + nonce + '_'; - } else { - arrowprefix = prefix; - } + arrowprefix = (randomizeIds) ? `${prefix}${nonce}_` : prefix; const pathdata = { fw: {d: 'm0,0l10,5l-10,5l5,-5l-5,-5z', refx: 8, id: arrowprefix + 'fw'}, diff --git a/src/editor/extensions/ext-markers/ext-markers.js b/src/editor/extensions/ext-markers/ext-markers.js index 126afd99..e91a1d0e 100644 --- a/src/editor/extensions/ext-markers/ext-markers.js +++ b/src/editor/extensions/ext-markers/ext-markers.js @@ -189,10 +189,7 @@ export default { let viewBox = '0 0 100 100'; let markerWidth = 5; let markerHeight = 5; - let seType; - if (val.substr(0, 1) === '\\') { - seType = val.substr(1); - } else { seType = 'textmarker'; } + const seType = (val.substr(0, 1) === '\\') ? val.substr(1) : 'textmarker'; if (!markerTypes[seType]) { return undefined; } // an unknown type! diff --git a/src/editor/jgraduate/jQuery.jPicker.js b/src/editor/jgraduate/jQuery.jPicker.js index fc7ea90c..4b6c41c7 100755 --- a/src/editor/jgraduate/jQuery.jPicker.js +++ b/src/editor/jgraduate/jQuery.jPicker.js @@ -1,4 +1,4 @@ -/* eslint-disable no-bitwise, max-len */ +/* eslint-disable no-bitwise, max-len, unicorn/prefer-math-trunc, unicorn/prefer-ternary */ /** * @file jPicker (Adapted from version 1.1.6) * diff --git a/src/editor/svgedit.js b/src/editor/svgedit.js index 2497b273..8fab4eb1 100644 --- a/src/editor/svgedit.js +++ b/src/editor/svgedit.js @@ -2498,11 +2498,7 @@ editor.init = () => { $(context).parentsUntil('#svgcontent > g').andSelf().each(function () { if (this.id) { str += ' > ' + this.id; - if (this !== context) { - linkStr += ' > ' + this.id + ''; - } else { - linkStr += ' > ' + this.id; - } + linkStr += (this !== context) ? ` > ${this.id}` : ` > ${this.id}`; } }); @@ -2605,13 +2601,7 @@ editor.init = () => { if (toolButtonClick(showSel)) { options.fn(); } - let icon; - if (options.icon) { - icon = $.getSvgIcon(options.icon, true); - } else { - icon = $(options.sel).children().eq(0).clone(); - } - + const icon = (options.icon) ? $.getSvgIcon(options.icon, true) : $(options.sel).children().eq(0).clone(); icon[0].setAttribute('width', shower.width()); icon[0].setAttribute('height', shower.height()); shower.children(':not(.flyout_arrow_horiz)').remove(); @@ -3199,11 +3189,7 @@ editor.init = () => { const opts = {alpha: opac}; if (color.startsWith('url(#')) { let refElem = svgCanvas.getRefElem(color); - if (refElem) { - refElem = refElem.cloneNode(true); - } else { - refElem = $('#' + type + '_color defs *')[0]; - } + refElem = (refElem) ? refElem.cloneNode(true) : $('#' + type + '_color defs *')[0]; opts[refElem.tagName] = refElem; } else if (color.startsWith('#')) { opts.solidColor = color.substr(1); @@ -3267,14 +3253,10 @@ editor.init = () => { const colorBlocks = ['#FFF', '#888', '#000', 'chessboard']; str = ''; $.each(colorBlocks, function (i, e) { - if (e === 'chessboard') { - str += '
'; - } else { - str += '
'; - } + str += (e === 'chessboard') + // eslint-disable-next-line max-len + ? `
` + : `
`; }); $('#bg_blocks').append(str); const blocks = $('#bg_blocks div'); @@ -4344,7 +4326,7 @@ editor.init = () => { }; /** - * + * @param {string} pos indicate the alignment relative to top, bottom, middle etc.. * @returns {void} */ const clickAlign = (pos) => { @@ -5520,12 +5502,7 @@ editor.init = () => { const menu = ($(sel).parents('#main_menu').length); $(sel).each(function () { - let t; - if (menu) { - t = $(this).text().split(' [')[0]; - } else { - t = this.title.split(' [')[0]; - } + const t = (menu) ? $(this).text().split(' [')[0] : this.title.split(' [')[0]; let keyStr = ''; // Shift+Up $.each(keyval.split('/'), function (i, key) { diff --git a/src/editor/svgicons/jQuery.svgIcons.js b/src/editor/svgicons/jQuery.svgIcons.js index 0f203771..9f9499c5 100644 --- a/src/editor/svgicons/jQuery.svgIcons.js +++ b/src/editor/svgicons/jQuery.svgIcons.js @@ -93,14 +93,11 @@ const fixIDs = function (svgEl, svgNum, force) { const defs = svgEl.find('defs'); if (!defs.length) return svgEl; - let idElems; - if (isOpera) { - idElems = defs.find('*').filter(function () { + const idElems = (isOpera) + ? defs.find('*').filter(function () { return Boolean(this.id); - }); - } else { - idElems = defs.find('[id]'); - } + }) + : defs.find('[id]'); const allElems = svgEl[0].getElementsByTagName('*'), len = allElems.length; diff --git a/src/svgcanvas/path.js b/src/svgcanvas/path.js index 5f728a90..bae3e78d 100644 --- a/src/svgcanvas/path.js +++ b/src/svgcanvas/path.js @@ -1893,10 +1893,9 @@ export const pathActions = (function () { const absY = seglist.getItem(0).y; sSeg = stretchy.pathSegList.getItem(1); - if (sSeg.pathSegType === 4) { - newseg = drawnPath.createSVGPathSegLinetoAbs(absX, absY); - } else { - newseg = drawnPath.createSVGPathSegCurvetoCubicAbs( + newseg = (sSeg.pathSegType === 4) + ? drawnPath.createSVGPathSegLinetoAbs(absX, absY) + : drawnPath.createSVGPathSegCurvetoCubicAbs( absX, absY, sSeg.x1 / currentZoom, @@ -1904,8 +1903,6 @@ export const pathActions = (function () { absX, absY ); - } - const endseg = drawnPath.createSVGPathSegClosePath(); seglist.appendItem(newseg); seglist.appendItem(endseg); @@ -1960,13 +1957,12 @@ export const pathActions = (function () { // Use the segment defined by stretchy sSeg = stretchy.pathSegList.getItem(1); - if (sSeg.pathSegType === 4) { - newseg = drawnPath.createSVGPathSegLinetoAbs( + newseg = (sSeg.pathSegType === 4) + ? drawnPath.createSVGPathSegLinetoAbs( editorContext_.round(x), editorContext_.round(y) - ); - } else { - newseg = drawnPath.createSVGPathSegCurvetoCubicAbs( + ) + : drawnPath.createSVGPathSegCurvetoCubicAbs( editorContext_.round(x), editorContext_.round(y), sSeg.x1 / currentZoom, @@ -1974,7 +1970,6 @@ export const pathActions = (function () { sSeg.x2 / currentZoom, sSeg.y2 / currentZoom ); - } drawnPath.pathSegList.appendItem(newseg); diff --git a/src/svgcanvas/recalculate.js b/src/svgcanvas/recalculate.js index 39af2872..37956884 100644 --- a/src/svgcanvas/recalculate.js +++ b/src/svgcanvas/recalculate.js @@ -269,13 +269,7 @@ export const recalculateDimensions = function (selected) { const gangle = getRotationAngle(selected); if (gangle) { const a = gangle * Math.PI / 180; - let s; - if (Math.abs(a) > (1.0e-10)) { - s = Math.sin(a) / (1 - Math.cos(a)); - } else { - // TODO: This blows up if the angle is exactly 0! - s = 2 / a; - } + const s = Math.abs(a) > (1.0e-10) ? Math.sin(a) / (1 - Math.cos(a)) : 2 / a; for (let i = 0; i < tlist.numberOfItems; ++i) { const xform = tlist.getItem(i); if (xform.type === 4) { diff --git a/src/svgcanvas/svgcanvas.js b/src/svgcanvas/svgcanvas.js index 7f154ee3..7db161ef 100644 --- a/src/svgcanvas/svgcanvas.js +++ b/src/svgcanvas/svgcanvas.js @@ -2689,11 +2689,7 @@ class SvgCanvas { end = {x: 0, y: 0}; const coords = element.getAttribute('points'); const commaIndex = coords.indexOf(','); - if (commaIndex >= 0) { - keep = coords.includes(',', commaIndex + 1); - } else { - keep = coords.includes(' ', coords.indexOf(' ') + 1); - } + keep = commaIndex >= 0 ? coords.includes(',', commaIndex + 1) : coords.includes(' ', coords.indexOf(' ') + 1); if (keep) { element = pathActions.smoothPolylineIntoPath(element); } @@ -4495,11 +4491,9 @@ function hideCursor () { // set new svg document // If DOM3 adoptNode() available, use it. Otherwise fall back to DOM2 importNode() - if (svgdoc.adoptNode) { - svgcontent = svgdoc.adoptNode(newDoc.documentElement); - } else { - svgcontent = svgdoc.importNode(newDoc.documentElement, true); - } + svgcontent = svgdoc.adoptNode + ? svgdoc.adoptNode(newDoc.documentElement) + : svgdoc.importNode(newDoc.documentElement, true); svgroot.append(svgcontent); const content = $(svgcontent); @@ -4681,13 +4675,9 @@ function hideCursor () { this.prepareSvg(newDoc); // import new svg document into our document - let svg; // If DOM3 adoptNode() available, use it. Otherwise fall back to DOM2 importNode() - if (svgdoc.adoptNode) { - svg = svgdoc.adoptNode(newDoc.documentElement); - } else { - svg = svgdoc.importNode(newDoc.documentElement, true); - } + const svg = + svgdoc.adoptNode ? svgdoc.adoptNode(newDoc.documentElement) : svgdoc.importNode(newDoc.documentElement, true); uniquifyElems(svg); @@ -4705,11 +4695,7 @@ function hideCursor () { canvash = Number(svgcontent.getAttribute('height')); // imported content should be 1/3 of the canvas on its largest dimension - if (innerh > innerw) { - ts = 'scale(' + (canvash / 3) / vb[3] + ')'; - } else { - ts = 'scale(' + (canvash / 3) / vb[2] + ')'; - } + ts = innerh > innerw ? 'scale(' + (canvash / 3) / vb[3] + ')' : 'scale(' + (canvash / 3) / vb[2] + ')'; // Hack to make recalculateDimensions understand how to scale ts = 'translate(0) ' + ts + ' translate(0)';