From 490f42a9ad698519a48311c4b91a4e29c4406f55 Mon Sep 17 00:00:00 2001 From: David Ralph Date: Sat, 21 Aug 2021 11:11:00 +0100 Subject: [PATCH] style: codacy fixes --- .../helpers/autocomplete/autocomplete.scss | 2 +- .../modals/main/scss/settings/_dropdown.scss | 2 +- .../modals/main/scss/settings/_main.scss | 16 ++++++++++------ src/components/widgets/background/Background.jsx | 3 ++- .../widgets/background/PhotoInformation.jsx | 2 +- src/components/widgets/navbar/Navbar.jsx | 2 +- src/components/widgets/quote/Quote.jsx | 2 +- src/components/widgets/search/search.scss | 2 +- src/components/widgets/weather/weather.scss | 2 +- src/index.js | 2 +- src/modules/helpers/background/widget.js | 4 ++-- src/modules/helpers/date.js | 2 +- src/modules/helpers/interval.js | 4 ++-- src/modules/helpers/settings/index.js | 2 +- src/modules/helpers/settings/modals.js | 2 +- src/scss/modules/_buttons.scss | 2 +- 16 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/components/helpers/autocomplete/autocomplete.scss b/src/components/helpers/autocomplete/autocomplete.scss index 047759bc..c86bf5c9 100644 --- a/src/components/helpers/autocomplete/autocomplete.scss +++ b/src/components/helpers/autocomplete/autocomplete.scss @@ -47,4 +47,4 @@ background-color: rgba(0, 0, 0, 0.5); } } -} \ No newline at end of file +} diff --git a/src/components/modals/main/scss/settings/_dropdown.scss b/src/components/modals/main/scss/settings/_dropdown.scss index 6281e0c4..5acf049e 100644 --- a/src/components/modals/main/scss/settings/_dropdown.scss +++ b/src/components/modals/main/scss/settings/_dropdown.scss @@ -34,4 +34,4 @@ select { .dark select { background: url("data:image/svg+xml;utf8,") right center no-repeat, var(--sidebar) !important; } -} \ No newline at end of file +} diff --git a/src/components/modals/main/scss/settings/_main.scss b/src/components/modals/main/scss/settings/_main.scss index 2eb78867..21f1ad74 100644 --- a/src/components/modals/main/scss/settings/_main.scss +++ b/src/components/modals/main/scss/settings/_main.scss @@ -17,11 +17,11 @@ input { -webkit-appearance: none; vertical-align: middle; background: none; - + &::-webkit-color-swatch-wrapper { padding: 0; } - + &::-webkit-color-swatch { border: none; border-radius: 100%; @@ -37,11 +37,11 @@ input { -moz-appearance: none; vertical-align: middle; background: none; - + &::-moz-color-swatch-wrapper { padding: 0; } - + &::-moz-color-swatch { border: none; border-radius: 100%; @@ -176,7 +176,7 @@ legend { li { cursor: initial; font-size: 1rem; - list-style-type:disc; + list-style-type: disc; padding: 0; margin-left: 20px; } @@ -223,9 +223,13 @@ input[type=number] { h2 { font-size: 2rem !important; } - h2, span, svg { + + h2, + span, + svg { display: inline; } + svg { vertical-align: sub; font-size: 1.4rem; diff --git a/src/components/widgets/background/Background.jsx b/src/components/widgets/background/Background.jsx index f77a20cd..4e5aa3b6 100644 --- a/src/components/widgets/background/Background.jsx +++ b/src/components/widgets/background/Background.jsx @@ -153,7 +153,8 @@ export default class Background extends PureComponent { photographerURL: photographerURL, photoURL: photoURL } - } + }; + this.setState(object); localStorage.setItem('currentBackground', JSON.stringify(object)); diff --git a/src/components/widgets/background/PhotoInformation.jsx b/src/components/widgets/background/PhotoInformation.jsx index 5818e213..8df5aa71 100644 --- a/src/components/widgets/background/PhotoInformation.jsx +++ b/src/components/widgets/background/PhotoInformation.jsx @@ -52,7 +52,7 @@ export default function PhotoInformation(props) { img.onload = (event) => { setWidth(event.target.width); setHeight(event.target.height); - } + }; img.src = (localStorage.getItem('ddgProxy') === 'true' && !props.info.offline && !props.url.startsWith('data:')) ? window.constants.DDG_IMAGE_PROXY + props.url : props.url; // info is still there because we want the favourite button to work diff --git a/src/components/widgets/navbar/Navbar.jsx b/src/components/widgets/navbar/Navbar.jsx index 8fb824ad..1f9fcc3e 100644 --- a/src/components/widgets/navbar/Navbar.jsx +++ b/src/components/widgets/navbar/Navbar.jsx @@ -16,7 +16,7 @@ export default class Navbar extends PureComponent { const navbarIcons = document.querySelectorAll('.navbar-container'); for (let i = 0; i < navbarIcons.length; i++) { navbarIcons[i].style.fontSize = `${zoomNavbar}em`; - }; + } } componentDidMount() { diff --git a/src/components/widgets/quote/Quote.jsx b/src/components/widgets/quote/Quote.jsx index b8337aef..226427c0 100644 --- a/src/components/widgets/quote/Quote.jsx +++ b/src/components/widgets/quote/Quote.jsx @@ -142,7 +142,7 @@ export default class Quote extends PureComponent { author: data.author, authorlink: this.getAuthorLink(data.author), quoteLanguage: quotelanguage - } + }; this.setState(object); localStorage.setItem('currentQuote', JSON.stringify(object)); diff --git a/src/components/widgets/search/search.scss b/src/components/widgets/search/search.scss index 911b4dea..4f33617d 100644 --- a/src/components/widgets/search/search.scss +++ b/src/components/widgets/search/search.scss @@ -71,4 +71,4 @@ color: white; } } -} \ No newline at end of file +} diff --git a/src/components/widgets/weather/weather.scss b/src/components/widgets/weather/weather.scss index 56aa4b91..0256ef22 100644 --- a/src/components/widgets/weather/weather.scss +++ b/src/components/widgets/weather/weather.scss @@ -44,4 +44,4 @@ vertical-align: middle; font-size: 35px; } -} \ No newline at end of file +} diff --git a/src/index.js b/src/index.js index edc7aaeb..9cfd4667 100644 --- a/src/index.js +++ b/src/index.js @@ -35,7 +35,7 @@ if (localStorage.getItem('stats') === 'true') { window.stats = { tabLoad: () => '', postEvent: () => '' - } + }; } render( diff --git a/src/modules/helpers/background/widget.js b/src/modules/helpers/background/widget.js index 2af4b105..30d01f4d 100644 --- a/src/modules/helpers/background/widget.js +++ b/src/modules/helpers/background/widget.js @@ -1,7 +1,7 @@ // since there is so much code in the component, we have moved it to a separate file export function videoCheck(url) { return url.startsWith('data:video/') || url.endsWith('.mp4') || url.endsWith('.webm') || url.endsWith('.ogg'); -}; +} export function offlineBackground() { const offlineImages = require('./offlineImages.json'); @@ -20,7 +20,7 @@ export function offlineBackground() { offline: true, credit: photographer } - } + }; localStorage.setItem('currentBackground', JSON.stringify(object)); diff --git a/src/modules/helpers/date.js b/src/modules/helpers/date.js index 6295be73..302512fd 100644 --- a/src/modules/helpers/date.js +++ b/src/modules/helpers/date.js @@ -13,7 +13,7 @@ export function nth(d) { default: return d + 'th'; } -}; +} export function convertTimezone(date, tz) { return new Date((typeof date === 'string' ? new Date(date) : date).toLocaleString('en-US', { timeZone: tz })); diff --git a/src/modules/helpers/interval.js b/src/modules/helpers/interval.js index 2e712967..6a822fae 100644 --- a/src/modules/helpers/interval.js +++ b/src/modules/helpers/interval.js @@ -1,5 +1,5 @@ // based on https://stackoverflow.com/a/47009962 -export default function Interval(callback, interval, name) { +export default function interval(callback, interval, name) { const key = name + 'interval'; const timeInMs = localStorage.getItem(key); @@ -8,7 +8,7 @@ export default function Interval(callback, interval, name) { const executeCallback = () => { localStorage.setItem(key, Date.now()); callback(); - } + }; if (timeInMs) { const delta = now - parseInt(timeInMs); diff --git a/src/modules/helpers/settings/index.js b/src/modules/helpers/settings/index.js index fbef60db..b1b866f6 100644 --- a/src/modules/helpers/settings/index.js +++ b/src/modules/helpers/settings/index.js @@ -25,7 +25,7 @@ export function setDefaultSettings(reset) { // Finally we set this to true so it doesn't run the function on every load localStorage.setItem('firstRun', true); -}; +} export function loadSettings(hotreload) { document.getElementById('widgets').style.zoom = localStorage.getItem('widgetzoom') + '%'; diff --git a/src/modules/helpers/settings/modals.js b/src/modules/helpers/settings/modals.js index 0127e2b1..66e9725f 100644 --- a/src/modules/helpers/settings/modals.js +++ b/src/modules/helpers/settings/modals.js @@ -15,7 +15,7 @@ export function saveFile(data, filename = 'file') { e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); a.dispatchEvent(e); -}; +} export function exportSettings() { let settings = {}; diff --git a/src/scss/modules/_buttons.scss b/src/scss/modules/_buttons.scss index eb555f80..b6ab171f 100644 --- a/src/scss/modules/_buttons.scss +++ b/src/scss/modules/_buttons.scss @@ -76,7 +76,7 @@ cursor: pointer; &:hover { - background: var(--tab-active); + background: var(--tab-active); } svg {