From 479106b13ac9417fc45eb9a9fb29b76714c9afac Mon Sep 17 00:00:00 2001
From: 0x1eef <0x1eef@protonmail.com>
Date: Sat, 28 Oct 2023 12:11:45 -0300
Subject: [PATCH] Abide by 80col limit
---
.husky/pre-commit | 4 ++--
.prettierrc | 2 +-
src/js/components/AudioControl.tsx | 4 +++-
src/js/components/Stream.tsx | 3 ++-
src/js/components/Timer.tsx | 4 +++-
src/js/loaders/SurahIndexLoader.ts | 4 +++-
src/js/loaders/SurahStreamLoader.ts | 13 ++++++++++---
src/js/pages/SurahIndex.tsx | 9 +++++++--
src/js/pages/SurahStream.tsx | 4 +++-
9 files changed, 34 insertions(+), 13 deletions(-)
diff --git a/.husky/pre-commit b/.husky/pre-commit
index e95af56..609a89a 100755
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -3,8 +3,8 @@
pattern=".ts|.tsx|.js$"
files=$(git --no-pager diff --cached --name-only | grep -E -e "${pattern}")
if [ "$?" = "0" ]; then
- npm run prettier -- "${files}" || exit 1
- npm run eslint -- "${files}" || exit 1
+ npm run prettier -- -c ${files} || exit 1
+ npm run eslint -- ${files} || exit 1
git add "${files}"
exit 0
else
diff --git a/.prettierrc b/.prettierrc
index ab9c931..4538f90 100644
--- a/.prettierrc
+++ b/.prettierrc
@@ -3,6 +3,6 @@
"tabWidth": 2,
"semi": true,
"singleQuote": false,
- "printWidth": 90,
+ "printWidth": 80,
"arrowParens": "avoid"
}
diff --git a/src/js/components/AudioControl.tsx b/src/js/components/AudioControl.tsx
index 5f4d08f..21d5f62 100644
--- a/src/js/components/AudioControl.tsx
+++ b/src/js/components/AudioControl.tsx
@@ -44,7 +44,9 @@ export function AudioControl({
useEffect(() => {
if (soundOn) {
- audio.src = [url.format(recitation.url), surah.id, `${ayah.id}.mp3`].join("/");
+ audio.src = [url.format(recitation.url), surah.id, `${ayah.id}.mp3`].join(
+ "/",
+ );
audio.play();
} else {
audio.pause();
diff --git a/src/js/components/Stream.tsx b/src/js/components/Stream.tsx
index 05752a2..44de9b6 100644
--- a/src/js/components/Stream.tsx
+++ b/src/js/components/Stream.tsx
@@ -40,7 +40,8 @@ export function Stream({
)}
{t(locale, "surah")} {formatNumber(surah.id, locale)}
- {t(locale, "comma")} {t(locale, "ayah")} {formatNumber(ayah.id, locale)}
+ {t(locale, "comma")} {t(locale, "ayah")}{" "}
+ {formatNumber(ayah.id, locale)}
{ayah.text}
diff --git a/src/js/components/Timer.tsx b/src/js/components/Timer.tsx
index 0aee2a7..e2584f0 100644
--- a/src/js/components/Timer.tsx
+++ b/src/js/components/Timer.tsx
@@ -53,7 +53,9 @@ export function Timer({
return (
- {ms / 1000 <= 0 ? formatNumber(0, locale) : formatNumber(ms / 1000, locale)}
+ {ms / 1000 <= 0
+ ? formatNumber(0, locale)
+ : formatNumber(ms / 1000, locale)}
);
}
diff --git a/src/js/loaders/SurahIndexLoader.ts b/src/js/loaders/SurahIndexLoader.ts
index 3c024aa..37de3af 100644
--- a/src/js/loaders/SurahIndexLoader.ts
+++ b/src/js/loaders/SurahIndexLoader.ts
@@ -23,6 +23,8 @@ import postman, { item } from "postman";
parent.remove();
pkg.fonts.forEach(f => document.fonts.add(f));
pkg.css.forEach(s => document.head.appendChild(s));
- pkg.scripts.forEach(s => document.body.removeChild(document.body.appendChild(s)));
+ pkg.scripts.forEach(s =>
+ document.body.removeChild(document.body.appendChild(s)),
+ );
});
})();
diff --git a/src/js/loaders/SurahStreamLoader.ts b/src/js/loaders/SurahStreamLoader.ts
index 6001508..8da7ae2 100644
--- a/src/js/loaders/SurahStreamLoader.ts
+++ b/src/js/loaders/SurahStreamLoader.ts
@@ -7,7 +7,8 @@ import * as Quran from "lib/Quran";
const progressBar: HTMLProgressElement = parent.querySelector("progress")!;
const progressNumber: HTMLSpanElement = parent.querySelector(".percentage")!;
const inlineStyle: HTMLStyleElement = document.querySelector(".css.postman")!;
- const { locale, surahId } = document.querySelector(".root")!.dataset;
+ const { locale, surahId } =
+ document.querySelector(".root")!.dataset;
const recitations = JSON.parse(
document.querySelector(".json.recitations")!.innerText,
);
@@ -19,7 +20,11 @@ import * as Quran from "lib/Quran";
item.font("Amiri Quran Regular", "url(/fonts/amiri-quran-regular.ttf"),
item.json(`/${locale}/${surahId}/surah.json`, { className: "surah" }),
...recitations.map((recitation: Quran.Recitation) => {
- const ts = [url.format(recitation.url), "time_slots", `${surahId}.json`].join("/");
+ const ts = [
+ url.format(recitation.url),
+ "time_slots",
+ `${surahId}.json`,
+ ].join("/");
return item.json(ts, {
className: `recitation time-slots ${recitation.id}`,
});
@@ -36,6 +41,8 @@ import * as Quran from "lib/Quran";
pkg.fonts.forEach(f => document.fonts.add(f));
pkg.css.forEach(s => document.head.appendChild(s));
pkg.json.forEach(o => document.body.appendChild(o));
- pkg.scripts.forEach(s => document.body.removeChild(document.body.appendChild(s)));
+ pkg.scripts.forEach(s =>
+ document.body.removeChild(document.body.appendChild(s)),
+ );
});
})();
diff --git a/src/js/pages/SurahIndex.tsx b/src/js/pages/SurahIndex.tsx
index b89c582..98d93ae 100644
--- a/src/js/pages/SurahIndex.tsx
+++ b/src/js/pages/SurahIndex.tsx
@@ -27,7 +27,10 @@ function SurahIndex({ locale, surahs, t }: Props) {
}, [ref.current, theme]);
return (
-
+
{t(locale, "TheNobleQuran")}
@@ -74,5 +77,7 @@ function SurahIndex({ locale, surahs, t }: Props) {
},
);
- ReactDOM.createRoot(root).render();
+ ReactDOM.createRoot(root).render(
+ ,
+ );
})();
diff --git a/src/js/pages/SurahStream.tsx b/src/js/pages/SurahStream.tsx
index 918a8ee..42f515e 100644
--- a/src/js/pages/SurahStream.tsx
+++ b/src/js/pages/SurahStream.tsx
@@ -122,7 +122,9 @@ function SurahStream({ node, recitations, locale, paused, t }: Props) {
isStalled={isStalled}
/>
)}
- {readyToRender && endOfStream && setStream([])} />}
+ {readyToRender && endOfStream && (
+ setStream([])} />
+ )}
{readyToRender && soundOn && isStalled && }