diff --git a/.github/workflows/rome.yml b/.github/workflows/biome.yml similarity index 92% rename from .github/workflows/rome.yml rename to .github/workflows/biome.yml index a3e2758..e9e23d7 100644 --- a/.github/workflows/rome.yml +++ b/.github/workflows/biome.yml @@ -20,12 +20,12 @@ jobs: - name: Install dependencies - run: zypper --non-interactive --gpg-auto-import-keys install rome + run: zypper --non-interactive --gpg-auto-import-keys install biome - name: Lint run: | - rome check . + biome check . - name: Format run: | - rome ci . \ No newline at end of file + biome ci . \ No newline at end of file diff --git a/rome.json b/biome.json similarity index 65% rename from rome.json rename to biome.json index 3617479..80b6524 100644 --- a/rome.json +++ b/biome.json @@ -3,8 +3,10 @@ "enabled": true, "rules": { "recommended": true, - "nursery": { - "useConst": "error", + "style": { + "useConst": "error" + }, + "suspicious": { "noAssignInExpressions": "off" } } diff --git a/github.com/index.js b/github.com/index.js index 40525a8..fac19a9 100644 --- a/github.com/index.js +++ b/github.com/index.js @@ -1,7 +1,7 @@ import { onBrowse, sleep } from "./../util.js"; onBrowse(async () => { - const fileRegex = /\/([^/]+)\/([^/]+)\/blob\/([^]+)\/(.+)/; + const fileRegex = /\/([^/]+)\/([^/]+)\/blob\/(.+)\/(.+)/; const fileMatch = location.pathname.match(fileRegex); @@ -29,9 +29,9 @@ onBrowse(async () => { commits = getCommits(); if (commits.length > 0) { break; - } else { - await sleep(500); } + + await sleep(500); } while (++attempts < 10); const ctr = document.querySelector(".range-editor"); diff --git a/google.com/index.js b/google.com/index.js index 4306c1f..0ceb6e4 100644 --- a/google.com/index.js +++ b/google.com/index.js @@ -33,7 +33,7 @@ onBrowse(() => { * * @see https://gist.github.com/chris-kwl/6172eb00971ab81bf99a213682b42e21 */ -const disableOnmousedown = function (node) { +const disableOnmousedown = (node) => { const as = node.getElementsByTagName("a"); for (let a = as[0], i = 1; a; i++) { a.removeAttribute("data-jsarwt"); @@ -41,7 +41,7 @@ const disableOnmousedown = function (node) { } }; -const disableOnmousedownOfInsertedNode = function (evt) { +const disableOnmousedownOfInsertedNode = (evt) => { const node = evt.target; //const requestURL = evt.newValue; //const parentNode = evt.relatedNode; diff --git a/holy-bhagavad-gita.org/index.js b/holy-bhagavad-gita.org/index.js index df2b971..0b0c3a1 100644 --- a/holy-bhagavad-gita.org/index.js +++ b/holy-bhagavad-gita.org/index.js @@ -12,12 +12,12 @@ b.style.backgroundImage = "none"; /** * remove promotional content for social media */ -[".fbLikeBoxHolder", ".subscribe"].forEach((css) => { +for (const css of [".fbLikeBoxHolder", ".subscribe"]) { const like = document.querySelector(css); if (like) { like.parentNode.remove(); } -}); +} /** * automatically move to next verse diff --git a/index.js b/index.js index 769eaa7..78f5659 100644 --- a/index.js +++ b/index.js @@ -24,6 +24,7 @@ switch (location.host) { case "npmjs.com": case "reddit.com": case "youtube.com": + // biome-ignore lint/suspicious/noFallthroughSwitchClause: intentional target = domain; default: { if (/(ggpht|googleusercontent).com$/.test(domain)) { diff --git a/reddit.com/index.js b/reddit.com/index.js index dc38a2a..5715303 100644 --- a/reddit.com/index.js +++ b/reddit.com/index.js @@ -46,7 +46,7 @@ function run_it(node = document) { const sections = location.pathname.split(/(?!^)\//); const loc = sections[0]; if (["/user", "/r"].includes(loc)) { - [...node.querySelectorAll("a")].forEach((element) => { + for (const element of node.querySelectorAll("a")) { const href = element.getAttribute("href"); if (!href) { return; @@ -113,7 +113,7 @@ function run_it(node = document) { 'url("https://upload.wikimedia.org/wikipedia/commons/0/0f/External-link-ltr-icon_Dark.png")'; element.style.paddingRight = "11px"; } - }); + } } node.marked = true; } diff --git a/util.js b/util.js index 6fe6307..d2fa4a7 100644 --- a/util.js +++ b/util.js @@ -8,14 +8,14 @@ export const onBrowse = (doit) => { window.onpopstate = doit; // https://stackoverflow.com/a/64927639/270302 - ["pushState", "replaceState"].forEach((type) => { + for (const type of ["pushState", "replaceState"]) { window.history[type] = new Proxy(window.history[type], { apply: (target, thisarg, argarray) => { doit(); return target.apply(thisarg, argarray); }, }); - }); + } doit(); };