Skip to content

Commit

Permalink
Migrate from rome to biome (#7)
Browse files Browse the repository at this point in the history
Including suggested changes to style/format.
  • Loading branch information
avindra authored Feb 9, 2024
1 parent f4a1e47 commit 826ae80
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/rome.yml → .github/workflows/biome.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
biome ci .
6 changes: 4 additions & 2 deletions rome.json → biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
"enabled": true,
"rules": {
"recommended": true,
"nursery": {
"useConst": "error",
"style": {
"useConst": "error"
},
"suspicious": {
"noAssignInExpressions": "off"
}
}
Expand Down
6 changes: 3 additions & 3 deletions github.com/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { onBrowse, sleep } from "./../util.js";

onBrowse(async () => {
const fileRegex = /\/([^/]+)\/([^/]+)\/blob\/([^]+)\/(.+)/;
const fileRegex = /\/([^/]+)\/([^/]+)\/blob\/(.+)\/(.+)/;

const fileMatch = location.pathname.match(fileRegex);

Expand Down Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions google.com/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ 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");
a = as[i];
}
};

const disableOnmousedownOfInsertedNode = function (evt) {
const disableOnmousedownOfInsertedNode = (evt) => {
const node = evt.target;
//const requestURL = evt.newValue;
//const parentNode = evt.relatedNode;
Expand Down
4 changes: 2 additions & 2 deletions holy-bhagavad-gita.org/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions reddit.com/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
4 changes: 2 additions & 2 deletions util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};

0 comments on commit 826ae80

Please sign in to comment.