From aba816036f7dc5bfe8a04f5ccf358e0163cc94a6 Mon Sep 17 00:00:00 2001 From: xidedix Date: Mon, 23 Apr 2018 12:55:10 +0200 Subject: [PATCH 1/3] chore: adjust linebreak-style eslint rule --- .eslintrc.json | 2 +- .gitattributes | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .gitattributes diff --git a/.eslintrc.json b/.eslintrc.json index d44b192..141c0df 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -141,7 +141,7 @@ "jsx-quotes": "error", "key-spacing": "off", "keyword-spacing": "error", - "linebreak-style": ["error", "unix"], + "linebreak-style": 0, "line-comment-position": "off", "lines-around-comment": "off", "lines-around-directive": "error", diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ba71cca --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.css text eol=lf +*.js text eol=lf From e97475ed910b98126568cd6c7662b143bfb32b8f Mon Sep 17 00:00:00 2001 From: xidedix Date: Mon, 23 Apr 2018 13:50:58 +0200 Subject: [PATCH 2/3] refactor: extract _setCanvasId function --- js/custom-tooltips.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/js/custom-tooltips.js b/js/custom-tooltips.js index 8ce42b9..ec54718 100644 --- a/js/custom-tooltips.js +++ b/js/custom-tooltips.js @@ -7,12 +7,15 @@ function CustomTooltips(tooltipModel) { // Add unique id if not exist - if (!this._chart.canvas.id) { - const _hex = 16 - const _multiply = 0x10000 - const _idMaker = () => ((1 + Math.random()) * _multiply | 0).toString(_hex) - const _canvasId = `_canvas${_idMaker() + _idMaker()}` - this._chart.canvas.id = this._chart.canvas.id || _canvasId + const _setCanvasId = () => { + const _idMaker = () => { + const _hex = 16 + const _multiplier = 0x10000 + return ((1 + Math.random()) * _multiplier | 0).toString(_hex) + } + const _canvasId = `_canvas-${_idMaker() + _idMaker()}` + this._chart.canvas.id = _canvasId + return _canvasId } const ClassName = { @@ -32,7 +35,7 @@ function CustomTooltips(tooltipModel) { const Selector = { DIV : 'div', SPAN : 'span', - TOOLTIP : `${this._chart.canvas.id}-tooltip` + TOOLTIP : `${this._chart.canvas.id || _setCanvasId()}-tooltip` } let tooltip = document.getElementById(Selector.TOOLTIP) From cd3d682e0c7048476a85908caa1da76ccf4411bc Mon Sep 17 00:00:00 2001 From: xidedix Date: Mon, 23 Apr 2018 13:54:11 +0200 Subject: [PATCH 3/3] chore: dependencies update --- package.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 37fa9c4..2154882 100644 --- a/package.json +++ b/package.json @@ -43,20 +43,20 @@ "watch-js": "nodemon --ignore dist/ -e js -x npm run js" }, "devDependencies": { - "@babel/cli": "7.0.0-beta.42", - "@babel/core": "7.0.0-beta.42", - "@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.42", - "@babel/preset-env": "7.0.0-beta.42", - "babel-eslint": "^8.2.2", - "babel-plugin-istanbul": "^4.1.5", + "@babel/cli": "7.0.0-beta.46", + "@babel/core": "7.0.0-beta.46", + "@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.46", + "@babel/preset-env": "7.0.0-beta.46", + "babel-eslint": "^8.2.3", + "babel-plugin-istanbul": "^4.1.6", "babel-plugin-transform-es2015-modules-strip": "^0.1.1", "babel-plugin-transform-object-rest-spread": "^6.26.0", "cross-env": "^5.1.4", - "eslint": "^4.16.0", - "eslint-plugin-compat": "^2.1.0", - "nodemon": "^1.12.1", + "eslint": "^4.19.1", + "eslint-plugin-compat": "^2.2.0", + "nodemon": "^1.17.3", "npm-run-all": "^4.1.2", - "uglify-js": "^3.3.8" + "uglify-js": "^3.3.22" }, "peerDependencies": { "chart.js": "^2.7.2"