From 66d5b3917b9b09f017ca90cc36e56e8602d15724 Mon Sep 17 00:00:00 2001 From: Thomas Gerbet Date: Mon, 15 Apr 2019 08:56:54 +0200 Subject: [PATCH] request #13278: Remove direct usage of the v-html directive in Vue apps v-html usages is replaced by a safer by default alternative. The goals are multiple: * make it easier to do the right thing for the developers: besides telling Vue to use the plugin at the instantiation of the app, the new directive can be used directly. There is no need of defining a new computed properties to sanize the value which means less boilerplate code. * reduce the number of points to inspect: only the directive/plugin code (and potentially a custom config at the init of the Vue app) instead of all the usages of v-html and the computed props associated with them. Note this does not means v-dompurify-html should be used everywhere, the usages should be limited where there is a real need for it and no alternative (same as v-html). No functionnal change is expected. vue-eslint-parser has been rollbacked to version 5.x. The 6.x version is not yet compatible with eslint-plugin-vue [0] causing false positives. It seems that major versions of vue-eslint-parser and eslint-plugin-vue must be kept in sync. [0] https://github.com/vuejs/eslint-plugin-vue/pull/807 Change-Id: Ibd599706cf3f6b19076841b4d7f330cab11e2e33 --- package-lock.json | 27 +++++++++--- package.json | 2 +- .../src/CallMeBack.vue | 9 +--- .../call-me-back-burning-parrot/src/index.js | 4 +- .../src/CallMeBack.vue | 9 +--- .../call-me-back-flaming-parrot/src/index.js | 4 +- .../create_test_env/scripts/package-lock.json | 8 ++++ plugins/create_test_env/scripts/package.json | 2 +- .../ItemDisplay/DisplayEmbeddedContent.vue | 7 ++-- .../QuickLook/QuickLookDocumentPreview.vue | 12 +++--- .../scripts/document/helpers/local-vue.js | 2 + plugins/document/scripts/document/index.js | 4 +- plugins/document/scripts/package-lock.json | 8 ++++ plugins/document/scripts/package.json | 2 +- plugins/label/www/scripts/package-lock.json | 8 ++++ plugins/label/www/scripts/package.json | 2 +- .../src/LabeledItem.spec.js | 42 ------------------- .../project-labeled-items/src/LabeledItem.vue | 20 ++------- .../project-labeled-items/src/app.spec.js | 5 ++- .../project-labeled-items/src/index.js | 8 +++- 20 files changed, 86 insertions(+), 99 deletions(-) delete mode 100644 plugins/label/www/scripts/project-labeled-items/src/LabeledItem.spec.js diff --git a/package-lock.json b/package-lock.json index 569781c4e79..98ad1748748 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14612,19 +14612,25 @@ "dev": true }, "vue-eslint-parser": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-6.0.3.tgz", - "integrity": "sha512-f2jZQojTLyZmuDLhCybJ8qIicfZfC6PmO7dEubZ0U/0tQ4dweRFuB0RpbbaHeMUfVFSYiKexbiemkze/h3/6SA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-5.0.0.tgz", + "integrity": "sha512-JlHVZwBBTNVvzmifwjpZYn0oPWH2SgWv5dojlZBsrhablDu95VFD+hriB1rQGwbD+bms6g+rAFhQHk6+NyiS6g==", "dev": true, "requires": { - "debug": "^4.1.1", + "debug": "^4.1.0", "eslint-scope": "^4.0.0", "eslint-visitor-keys": "^1.0.0", - "espree": "^5.0.0", + "espree": "^4.1.0", "esquery": "^1.0.1", "lodash": "^4.17.11" }, "dependencies": { + "acorn": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.1.tgz", + "integrity": "sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==", + "dev": true + }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -14634,6 +14640,17 @@ "ms": "^2.1.1" } }, + "espree": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-4.1.0.tgz", + "integrity": "sha512-I5BycZW6FCVIub93TeVY1s7vjhP9CY6cXCznIRfiig7nRviKZYdRnj/sHEWC6A7WE9RDWOFq9+7OsWSYz8qv2w==", + "dev": true, + "requires": { + "acorn": "^6.0.2", + "acorn-jsx": "^5.0.0", + "eslint-visitor-keys": "^1.0.0" + } + }, "lodash": { "version": "4.17.11", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", diff --git a/package.json b/package.json index 3b4cffa85fa..e1d1c893fc0 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "stylelint": "^9.9.0", "stylelint-config-property-sort-order-smacss": "^4.0.2", "stylelint-config-sass-guidelines": "^5.3.0", - "vue-eslint-parser": "^6.0.3", + "vue-eslint-parser": "^5.0.0", "vue-loader": "^15.4.2", "webpack": "^4.20.2", "webpack-assets-manifest": "^3.1.1", diff --git a/plugins/create_test_env/scripts/call-me-back-burning-parrot/src/CallMeBack.vue b/plugins/create_test_env/scripts/call-me-back-burning-parrot/src/CallMeBack.vue index f5e57360ad9..f2cbb2c6505 100644 --- a/plugins/create_test_env/scripts/call-me-back-burning-parrot/src/CallMeBack.vue +++ b/plugins/create_test_env/scripts/call-me-back-burning-parrot/src/CallMeBack.vue @@ -1,5 +1,5 @@