From 96746d7165f28553b53bd259d03aaf5d63290b7a Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 22 Sep 2020 17:49:49 +0200 Subject: Upgrade front end dependencies Mostly in order to get rid of deprecated deps, and upgrade vulnerable ones. - Upgrade webpack from 3.x to 4.x - Moved babel package to main repo - Replaced deprecated extract-text-webpack-plugin with extract-text-webpack-plugin - Replaced deprecated babel-minify-webpack-plugin with terser-webpack-plugin - Replaced deprecated node-sass with (dart) sass package - Replaced deprecated sass-lint with stylelint (the rules might be a bit different Related to #1531: trivy doesn't raise any more issue --- assets/default/scss/shaarli.scss | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'assets/default') diff --git a/assets/default/scss/shaarli.scss b/assets/default/scss/shaarli.scss index 7ab09d3f..f3782875 100644 --- a/assets/default/scss/shaarli.scss +++ b/assets/default/scss/shaarli.scss @@ -69,20 +69,22 @@ pre { font-family: 'Roboto'; font-weight: 400; font-style: normal; - src: local('Roboto'), - local('Roboto-Regular'), - url('../fonts/Roboto-Regular.woff2') format('woff2'), - url('../fonts/Roboto-Regular.woff') format('woff'); + src: + local('Roboto'), + local('Roboto-Regular'), + url('../fonts/Roboto-Regular.woff2') format('woff2'), + url('../fonts/Roboto-Regular.woff') format('woff'); } @font-face { font-family: 'Roboto'; font-weight: 700; font-style: normal; - src: local('Roboto'), - local('Roboto-Bold'), - url('../fonts/Roboto-Bold.woff2') format('woff2'), - url('../fonts/Roboto-Bold.woff') format('woff'); + src: + local('Roboto'), + local('Roboto-Bold'), + url('../fonts/Roboto-Bold.woff2') format('woff2'), + url('../fonts/Roboto-Bold.woff') format('woff'); } body, @@ -375,7 +377,7 @@ body, } @media screen and (max-width: 64em) { - .header-search , + .header-search, .header-search * { visibility: hidden; } @@ -554,7 +556,6 @@ body, color: $dark-grey; font-size: .9em; - a { display: inline-block; margin: 3px 0; @@ -620,7 +621,7 @@ body, &.selected { background: var(--main-color); color: $white; - } + } } input { @@ -1609,13 +1610,14 @@ form { > div { border-radius: 10px; - background: repeating-linear-gradient( - -45deg, - $almost-white, - $almost-white 6px, - var(--background-color) 6px, - var(--background-color) 12px - ); + background: + repeating-linear-gradient( + -45deg, + $almost-white, + $almost-white 6px, + var(--background-color) 6px, + var(--background-color) 12px + ); width: 0%; height: 10px; } -- cgit v1.2.3 From 9192a48be300fcfd2a6ede927b0611c66f250012 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 22 Sep 2020 18:14:18 +0200 Subject: Fix ESLint after dependency upgrade --- assets/default/js/base.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'assets/default') diff --git a/assets/default/js/base.js b/assets/default/js/base.js index 27938823..d9933152 100644 --- a/assets/default/js/base.js +++ b/assets/default/js/base.js @@ -10,7 +10,7 @@ import Awesomplete from 'awesomplete'; * @returns Found element or null. */ function findParent(element, tagName, attributes) { - const parentMatch = key => attributes[key] !== '' && element.getAttribute(key).indexOf(attributes[key]) !== -1; + const parentMatch = (key) => attributes[key] !== '' && element.getAttribute(key).indexOf(attributes[key]) !== -1; while (element) { if (element.tagName.toLowerCase() === tagName) { if (Object.keys(attributes).find(parentMatch)) { @@ -101,7 +101,7 @@ function updateAwesompleteList(selector, tags, instances) { * @see http://stackoverflow.com/questions/18749591/encode-html-entities-in-javascript */ function htmlEntities(str) { - return str.replace(/[\u00A0-\u9999<>&]/gim, i => `&#${i.charCodeAt(0)};`); + return str.replace(/[\u00A0-\u9999<>&]/gim, (i) => `&#${i.charCodeAt(0)};`); } /** @@ -194,8 +194,8 @@ function removeClass(element, classname) { function init(description) { function resize() { /* Fix jumpy resizing: https://stackoverflow.com/a/18262927/1484919 */ - const scrollTop = window.pageYOffset || - (document.documentElement || document.body.parentNode || document.body).scrollTop; + const scrollTop = window.pageYOffset + || (document.documentElement || document.body.parentNode || document.body).scrollTop; description.style.height = 'auto'; description.style.height = `${description.scrollHeight + 10}px`; @@ -490,9 +490,10 @@ function init(description) { }); }); - const ids = links.map(item => item.id); - window.location = - `${basePath}/admin/shaare/visibility?token=${token.value}&newVisibility=${visibility}&id=${ids.join('+')}`; + const ids = links.map((item) => item.id); + window.location = ( + `${basePath}/admin/shaare/visibility?token=${token.value}&newVisibility=${visibility}&id=${ids.join('+')}` + ); }); }); } @@ -575,7 +576,7 @@ function init(description) { .setAttribute('href', `${basePath}/admin/tags?fromtag=${encodeURIComponent(totag)}`); // Refresh awesomplete values - existingTags = existingTags.map(tag => (tag === fromtag ? totag : tag)); + existingTags = existingTags.map((tag) => (tag === fromtag ? totag : tag)); awesomepletes = updateAwesompleteList('.rename-tag-input', existingTags, awesomepletes); } }; @@ -614,7 +615,7 @@ function init(description) { xhr.send(encodeURI(`deletetag=1&fromtag=${tag}&token=${refreshedToken}`)); refreshToken(basePath); - existingTags = existingTags.filter(tagItem => tagItem !== tag); + existingTags = existingTags.filter((tagItem) => tagItem !== tag); awesomepletes = updateAwesompleteList('.rename-tag-input', existingTags, awesomepletes); } }); -- cgit v1.2.3