From 75aa44eef677b790768262638df0de223fd01a56 Mon Sep 17 00:00:00 2001 From: Simon Brunel Date: Sun, 18 Nov 2018 09:33:34 +0100 Subject: [PATCH] Upgrade dev dependencies to reduce vulnerabilities (#5840) --- gulpfile.js | 12 ++++---- package.json | 44 ++++++++++++++--------------- src/platforms/platform.dom.js | 2 ++ test/specs/core.controller.tests.js | 16 ++--------- test/specs/core.plugin.tests.js | 2 ++ 5 files changed, 34 insertions(+), 42 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index d8872df0e31..06229d6f89c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -49,19 +49,19 @@ gulp.task('bower', bowerTask); gulp.task('build', buildTask); gulp.task('package', packageTask); gulp.task('watch', watchTask); -gulp.task('lint', ['lint-html', 'lint-js']); gulp.task('lint-html', lintHtmlTask); gulp.task('lint-js', lintJsTask); +gulp.task('lint', gulp.parallel('lint-html', 'lint-js')); gulp.task('docs', docsTask); -gulp.task('test', ['lint', 'unittest']); -gulp.task('size', ['library-size', 'module-sizes']); gulp.task('server', serverTask); gulp.task('unittest', unittestTask); +gulp.task('test', gulp.parallel('lint', 'unittest')); gulp.task('library-size', librarySizeTask); gulp.task('module-sizes', moduleSizesTask); +gulp.task('size', gulp.parallel('library-size', 'module-sizes')); gulp.task('_open', _openTask); -gulp.task('dev', ['server', 'default']); -gulp.task('default', ['build', 'watch']); +gulp.task('default', gulp.parallel('build', 'watch')); +gulp.task('dev', gulp.parallel('server', 'default')); /** * Generates the bower.json manifest file which will be pushed along release tags. @@ -233,7 +233,7 @@ function moduleSizesTask() { } function watchTask() { - return gulp.watch('./src/**', ['build']); + return gulp.watch('./src/**', gulp.parallel('build')); } function serverTask() { diff --git a/package.json b/package.json index 30e365f7467..b8c72f99afb 100644 --- a/package.json +++ b/package.json @@ -10,42 +10,42 @@ "url": "https://github.com/chartjs/Chart.js.git" }, "devDependencies": { - "browserify": "^14.5.0", + "browserify": "^16.2.3", "browserify-istanbul": "^3.0.1", "bundle-collapser": "^1.3.0", "child-process-promise": "^2.2.1", "coveralls": "^3.0.0", - "eslint": "^4.9.0", + "eslint": "^5.9.0", "eslint-config-chartjs": "^0.1.0", - "eslint-plugin-html": "^4.0.2", + "eslint-plugin-html": "^5.0.0", "gitbook-cli": "^2.3.2", - "gulp": "3.9.x", - "gulp-concat": "~2.6.x", - "gulp-connect": "~5.0.0", - "gulp-eslint": "^4.0.0", - "gulp-file": "^0.3.0", - "gulp-htmllint": "^0.0.15", - "gulp-insert": "~0.5.0", - "gulp-replace": "^0.6.1", - "gulp-size": "~2.1.0", + "gulp": "^4.0.0", + "gulp-concat": "^2.6.0", + "gulp-connect": "^5.6.1", + "gulp-eslint": "^5.0.0", + "gulp-file": "^0.4.0", + "gulp-htmllint": "^0.0.16", + "gulp-insert": "^0.5.0", + "gulp-replace": "^1.0.0", + "gulp-size": "^3.0.0", "gulp-streamify": "^1.0.2", - "gulp-uglify": "~3.0.x", - "gulp-util": "~3.0.x", - "gulp-zip": "~4.0.0", - "jasmine": "^2.8.0", - "jasmine-core": "^2.8.0", - "karma": "^1.7.1", + "gulp-uglify": "^3.0.0", + "gulp-util": "^3.0.0", + "gulp-zip": "^4.2.0", + "jasmine": "^3.3.0", + "jasmine-core": "^3.3.0", + "karma": "^3.1.1", "karma-browserify": "^5.1.1", "karma-chrome-launcher": "^2.2.0", "karma-coverage": "^1.1.1", "karma-firefox-launcher": "^1.0.1", - "karma-jasmine": "^1.1.0", - "karma-jasmine-html-reporter": "^0.2.2", + "karma-jasmine": "^2.0.0", + "karma-jasmine-html-reporter": "^1.4.0", "merge-stream": "^1.0.1", "pixelmatch": "^4.0.2", - "vinyl-source-stream": "^1.1.0", + "vinyl-source-stream": "^2.0.0", "watchify": "^3.9.0", - "yargs": "^9.0.1" + "yargs": "^12.0.2" }, "spm": { "main": "Chart.js" diff --git a/src/platforms/platform.dom.js b/src/platforms/platform.dom.js index a882d22a537..549ec1a1ca4 100644 --- a/src/platforms/platform.dom.js +++ b/src/platforms/platform.dom.js @@ -108,6 +108,7 @@ var supportsEventListenerOptions = (function() { var supports = false; try { var options = Object.defineProperty({}, 'passive', { + // eslint-disable-next-line getter-return get: function() { supports = true; } @@ -391,6 +392,7 @@ module.exports = { // we can't use save() and restore() to restore the initial state. So make sure that at // least the canvas context is reset to the default state by setting the canvas width. // https://www.w3.org/TR/2011/WD-html5-20110525/the-canvas-element.html + // eslint-disable-next-line no-self-assign canvas.width = canvas.width; delete canvas[EXPANDO_KEY]; diff --git a/test/specs/core.controller.tests.js b/test/specs/core.controller.tests.js index 1ca699bc132..cf9eb30a22b 100644 --- a/test/specs/core.controller.tests.js +++ b/test/specs/core.controller.tests.js @@ -949,25 +949,13 @@ describe('Chart', function() { var meta = chart.getDatasetMeta(0); var point = meta.data[1]; - var node = chart.canvas; - var rect = node.getBoundingClientRect(); - - var evt = new MouseEvent('mousemove', { - view: window, - bubbles: true, - cancelable: true, - clientX: rect.left + point._model.x, - clientY: 0 - }); - - // Manually trigger rather than having an async test - node.dispatchEvent(evt); + jasmine.triggerMouseEvent(chart, 'mousemove', point); // Check and see if tooltip was displayed var tooltip = chart.tooltip; expect(chart.lastActive).toEqual([point]); - expect(tooltip._lastActive).toEqual([]); + expect(tooltip._lastActive).toEqual([point]); // Update and confirm tooltip is reset chart.update(); diff --git a/test/specs/core.plugin.tests.js b/test/specs/core.plugin.tests.js index 3a9e908a38d..977f607a7c9 100644 --- a/test/specs/core.plugin.tests.js +++ b/test/specs/core.plugin.tests.js @@ -323,6 +323,8 @@ describe('Chart.plugins', function() { expect(plugin.hook).toHaveBeenCalled(); expect(plugin.hook.calls.first().args[1]).toEqual({a: 42}); + + delete Chart.defaults.global.plugins.a; });