From 6e1a953d63e8f23cc27938421765cbc94541f792 Mon Sep 17 00:00:00 2001 From: Bauke Date: Mon, 9 Jan 2023 16:09:00 +0100 Subject: [PATCH] Fix linting issues. --- source/js/listenbrainz.js | 35 +++++++++++++++-------- source/scss/components/_listenbrainz.scss | 2 +- source/scss/components/_page-footer.scss | 2 +- source/scss/components/_page-header.scss | 2 +- source/scss/components/_page-main.scss | 6 ++-- source/scss/index.scss | 10 +++---- source/scss/modern-normalize.scss | 2 +- 7 files changed, 35 insertions(+), 24 deletions(-) diff --git a/source/js/listenbrainz.js b/source/js/listenbrainz.js index 34dcd14..09ab7cd 100644 --- a/source/js/listenbrainz.js +++ b/source/js/listenbrainz.js @@ -1,4 +1,6 @@ -window.addEventListener('DOMContentLoaded', async () => { +/* global document window */ + +window.addEventListener("DOMContentLoaded", async () => { const loop = async () => { const listen = await getCurrentListen(); if (listen === undefined) { @@ -26,11 +28,14 @@ async function getCoverArt(listen) { return; } - const result = await window.fetch(`https://coverartarchive.org/release/${releaseMbid}`, { - headers: { - Accept: 'application/json', + const result = await window.fetch( + `https://coverartarchive.org/release/${releaseMbid}`, + { + headers: { + Accept: "application/json", + }, }, - }); + ); if (!result.ok) { return; } @@ -41,11 +46,15 @@ async function getCoverArt(listen) { } const thumbnails = data.images[0].thumbnails; - return thumbnails.small ?? thumbnails['250'] ?? thumbnails['500'] ?? undefined; + return ( + thumbnails.small ?? thumbnails["250"] ?? thumbnails["500"] ?? undefined + ); } async function getCurrentListen() { - const result = await window.fetch('https://api.listenbrainz.org/1/user/BaukeXYZ/playing-now'); + const result = await window.fetch( + "https://api.listenbrainz.org/1/user/BaukeXYZ/playing-now", + ); if (!result.ok) { console.warn(result.status); return; @@ -64,16 +73,16 @@ function insertHtml(listen, image) { return; } - const existing = document.querySelector('.listenbrainz') ?? undefined; + const existing = document.querySelector(".listenbrainz") ?? undefined; if (existing !== undefined) { existing.remove(); } const text = `${listen.track_metadata.artist_name} - ${listen.track_metadata.track_name}`; - const alt = image === undefined ? 'ListenBrainz Logo' : `${text} Cover Art`; + const alt = image === undefined ? "ListenBrainz Logo" : `${text} Cover Art`; - image = image ?? 'https://listenbrainz.org/static/img/logo_big.svg'; - image = image.startsWith('http://') ? 'https' + image.slice(4) : image; + image = image ?? "https://listenbrainz.org/static/img/logo_big.svg"; + image = image.startsWith("http://") ? "https" + image.slice(4) : image; const listenHtml = `

@@ -84,5 +93,7 @@ function insertHtml(listen, image) {

`; - document.querySelector('.page-header').insertAdjacentHTML('beforeend', listenHtml); + document + .querySelector(".page-header") + .insertAdjacentHTML("beforeend", listenHtml); } diff --git a/source/scss/components/_listenbrainz.scss b/source/scss/components/_listenbrainz.scss index 9a98d1d..ef09fb0 100644 --- a/source/scss/components/_listenbrainz.scss +++ b/source/scss/components/_listenbrainz.scss @@ -1,4 +1,4 @@ -@use 'mixins'; +@use "mixins"; .listenbrainz { align-items: center; diff --git a/source/scss/components/_page-footer.scss b/source/scss/components/_page-footer.scss index 69352a6..429e054 100644 --- a/source/scss/components/_page-footer.scss +++ b/source/scss/components/_page-footer.scss @@ -1,4 +1,4 @@ -@use 'mixins'; +@use "mixins"; .page-footer { @include mixins.responsive-container; diff --git a/source/scss/components/_page-header.scss b/source/scss/components/_page-header.scss index de6f54b..779cf29 100644 --- a/source/scss/components/_page-header.scss +++ b/source/scss/components/_page-header.scss @@ -1,4 +1,4 @@ -@use 'mixins'; +@use "mixins"; .page-header { --anchor-color: #000; diff --git a/source/scss/components/_page-main.scss b/source/scss/components/_page-main.scss index 6fe256e..e037b8f 100644 --- a/source/scss/components/_page-main.scss +++ b/source/scss/components/_page-main.scss @@ -1,4 +1,4 @@ -@use 'mixins'; +@use "mixins"; .page-main { a { @@ -14,7 +14,7 @@ } &.driftingnebula { - background: url('/assets/driftingnebula 2022-03-09.jpeg'); + background: url("/assets/driftingnebula 2022-03-09.jpeg"); background-position: center center; background-repeat: no-repeat; @@ -24,7 +24,7 @@ } &.holllo { - background: url('/assets/holllo-mark-square-pattern.png'); + background: url("/assets/holllo-mark-square-pattern.png"); background-color: #1f1731; background-repeat: repeat; background-size: 48px; diff --git a/source/scss/index.scss b/source/scss/index.scss index 852c2ab..b878e4b 100644 --- a/source/scss/index.scss +++ b/source/scss/index.scss @@ -1,4 +1,4 @@ -@use 'reset'; +@use "reset"; html { font-size: 62.5%; @@ -43,7 +43,7 @@ button { margin-top: 2rem; } -@use 'components/page-footer'; -@use 'components/page-header'; -@use 'components/page-main'; -@use 'components/listenbrainz'; +@use "components/page-footer"; +@use "components/page-header"; +@use "components/page-main"; +@use "components/listenbrainz"; diff --git a/source/scss/modern-normalize.scss b/source/scss/modern-normalize.scss index 6c48814..38bdf7a 100644 --- a/source/scss/modern-normalize.scss +++ b/source/scss/modern-normalize.scss @@ -1 +1 @@ -@use '../../node_modules/modern-normalize/modern-normalize.css'; +@use "../../node_modules/modern-normalize/modern-normalize.css";