Skip to content

Commit

Permalink
chore: added biome
Browse files Browse the repository at this point in the history
  • Loading branch information
parnavh committed Sep 3, 2024
1 parent 6e689b0 commit 14303da
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 33 deletions.
13 changes: 13 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": false
},
"formatter": {
"indentStyle": "space",
"lineWidth": 80
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"postinstall": "wxt prepare"
},
"devDependencies": {
"@biomejs/biome": "1.8.3",
"@changesets/cli": "^2.27.7",
"@tailwindcss/typography": "^0.5.14",
"@tsconfig/svelte": "^5.0.4",
Expand Down
91 changes: 91 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/entrypoints/gregmat.content/vocab-mountain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async function showKeybinds() {
if (shown) return;

const container = document.querySelector(
".flex.w-full.flex-row.flex-wrap.justify-center.space-x-6.mt-6.gap-y-2.gap-x-2"
".flex.w-full.flex-row.flex-wrap.justify-center.space-x-6.mt-6.gap-y-2.gap-x-2",
);

if (!container || container.childNodes.length < 6) return;
Expand Down Expand Up @@ -117,7 +117,7 @@ async function addStats() {
await waitForElement("button[tabindex='-1']");

const parent = document.querySelector(
".w-full.flex.flex-col.justify-start.items-center.space-y-2"
".w-full.flex.flex-col.justify-start.items-center.space-y-2",
);

if (!parent) return;
Expand All @@ -131,14 +131,14 @@ async function addStats() {
"text-lg",
"dark:text-gray-50",
"text-center",
"mb-6"
"mb-6",
);
summary.setAttribute("id", "buddy-stats");
parent.prepend(summary);
}

const day = document.querySelector(
"h3[class='font-semibold text-lg dark:text-gray-50']"
"h3[class='font-semibold text-lg dark:text-gray-50']",
);

if (!day) return;
Expand Down Expand Up @@ -210,8 +210,8 @@ function getVocabStatsText(correct: number, total: number) {
return `<h3 class="font-semibold underline mb-2">Stats</h3>
<ul>
<li>Accuracy: ${correct}/${total} | <span class="font-semibold ml-1" style="color: ${color};">${percentage.toFixed(
2
)}%</span></li>
2,
)}%</span></li>
</ul>
`;
}
6 changes: 3 additions & 3 deletions src/entrypoints/popup/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import './app.css';
import App from './App.svelte';
import "./app.css";
import App from "./App.svelte";

const app = new App({
target: document.getElementById('app')!,
target: document.getElementById("app")!,
});

export default app;
40 changes: 17 additions & 23 deletions src/entrypoints/prepswift.content/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function main() {
calculate_time(container, summary);

const observer = new MutationObserver(() =>
calculate_time(container, summary)
calculate_time(container, summary),
);

document
Expand All @@ -43,7 +43,7 @@ async function main() {

async function calculate_time(
container: Element,
summary: HTMLParagraphElement
summary: HTMLParagraphElement,
) {
let rootTotalCount = 0,
rootDoneCount = 0,
Expand All @@ -53,28 +53,28 @@ async function calculate_time(
await waitForElement(".video-duration-badge");

Array.from(container.children).forEach((div) => {
let title = div.querySelector("h2");
const title = div.querySelector("h2");

if (!title) return;

let all = div.querySelectorAll(".video-duration-badge");
let done = div.querySelectorAll(".video-duration-badge.text-purple-400");
let allTimestamps = div.querySelectorAll(".video-duration-badge");
let doneTimestamps = div.querySelectorAll(
".video-duration-badge.text-purple-400"
const all = div.querySelectorAll(".video-duration-badge");
const done = div.querySelectorAll(".video-duration-badge.text-purple-400");
const allTimestamps = div.querySelectorAll(".video-duration-badge");
const doneTimestamps = div.querySelectorAll(
".video-duration-badge.text-purple-400",
);

let totalSecs = 0,
doneSecs = 0;

allTimestamps.forEach((a) => {
let s = (a.textContent ?? ":").split(":");
totalSecs += parseInt(s[0]) * 60 + parseInt(s[1]);
const s = (a.textContent ?? ":").split(":");
totalSecs += Number.parseInt(s[0]) * 60 + Number.parseInt(s[1]);
});

doneTimestamps.forEach((a) => {
let s = (a.textContent ?? ":").split(":");
doneSecs += parseInt(s[0]) * 60 + parseInt(s[1]);
const s = (a.textContent ?? ":").split(":");
doneSecs += Number.parseInt(s[0]) * 60 + Number.parseInt(s[1]);
});

rootTotalSecs += totalSecs;
Expand Down Expand Up @@ -103,21 +103,15 @@ function getText(
doneCount: number,
totalCount: number,
doneSecs: number,
totalSecs: number
totalSecs: number,
): string {
if (doneCount == totalCount) {
if (doneCount === totalCount) {
return "Done!";
}

if (doneCount == 0) {
return `Lectures: ${totalCount} | Mins: ${(totalSecs / 60).toFixed(
2
)} | Hours: ${(totalSecs / 3600).toFixed(2)}`;
if (doneCount === 0) {
return `Lectures: ${totalCount} | Mins: ${(totalSecs / 60).toFixed(2)} | Hours: ${(totalSecs / 3600).toFixed(2)}`;
}

return `Lectures: ${doneCount}/${totalCount} | Mins: ${(
doneSecs / 60
).toFixed(2)}/${(totalSecs / 60).toFixed(2)} | Hours: ${(
doneSecs / 3600
).toFixed(2)}/${(totalSecs / 3600).toFixed(2)}`;
return `Lectures: ${doneCount}/${totalCount} | Mins: ${(doneSecs / 60).toFixed(2)}/${(totalSecs / 60).toFixed(2)}| Hours: ${(doneSecs / 3600).toFixed(2)}/${(totalSecs / 3600).toFixed(2)}`;
}
2 changes: 1 addition & 1 deletion src/utils/storage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const vimeoPlaybackRate = storage.defineItem<number>(
"local:vimeoPlaybackRate",
{ fallback: 1 }
{ fallback: 1 },
);

export const seenBanners = storage.defineItem<string[]>("local:seenBanners", {
Expand Down

0 comments on commit 14303da

Please sign in to comment.