Skip to content

Commit 826ae80

Browse files
authored
Migrate from rome to biome (#7)
Including suggested changes to style/format.
1 parent f4a1e47 commit 826ae80

File tree

8 files changed

+19
-16
lines changed

8 files changed

+19
-16
lines changed

.github/workflows/rome.yml renamed to .github/workflows/biome.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ jobs:
2020
2121
2222
- name: Install dependencies
23-
run: zypper --non-interactive --gpg-auto-import-keys install rome
23+
run: zypper --non-interactive --gpg-auto-import-keys install biome
2424

2525
- name: Lint
2626
run: |
27-
rome check .
27+
biome check .
2828
2929
- name: Format
3030
run: |
31-
rome ci .
31+
biome ci .

rome.json renamed to biome.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
"enabled": true,
44
"rules": {
55
"recommended": true,
6-
"nursery": {
7-
"useConst": "error",
6+
"style": {
7+
"useConst": "error"
8+
},
9+
"suspicious": {
810
"noAssignInExpressions": "off"
911
}
1012
}

github.com/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { onBrowse, sleep } from "./../util.js";
22

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

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

@@ -29,9 +29,9 @@ onBrowse(async () => {
2929
commits = getCommits();
3030
if (commits.length > 0) {
3131
break;
32-
} else {
33-
await sleep(500);
3432
}
33+
34+
await sleep(500);
3535
} while (++attempts < 10);
3636

3737
const ctr = document.querySelector(".range-editor");

google.com/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ onBrowse(() => {
3333
*
3434
* @see https://gist.github.com/chris-kwl/6172eb00971ab81bf99a213682b42e21
3535
*/
36-
const disableOnmousedown = function (node) {
36+
const disableOnmousedown = (node) => {
3737
const as = node.getElementsByTagName("a");
3838
for (let a = as[0], i = 1; a; i++) {
3939
a.removeAttribute("data-jsarwt");
4040
a = as[i];
4141
}
4242
};
4343

44-
const disableOnmousedownOfInsertedNode = function (evt) {
44+
const disableOnmousedownOfInsertedNode = (evt) => {
4545
const node = evt.target;
4646
//const requestURL = evt.newValue;
4747
//const parentNode = evt.relatedNode;

holy-bhagavad-gita.org/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ b.style.backgroundImage = "none";
1212
/**
1313
* remove promotional content for social media
1414
*/
15-
[".fbLikeBoxHolder", ".subscribe"].forEach((css) => {
15+
for (const css of [".fbLikeBoxHolder", ".subscribe"]) {
1616
const like = document.querySelector(css);
1717
if (like) {
1818
like.parentNode.remove();
1919
}
20-
});
20+
}
2121

2222
/**
2323
* automatically move to next verse

index.js

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ switch (location.host) {
2424
case "npmjs.com":
2525
case "reddit.com":
2626
case "youtube.com":
27+
// biome-ignore lint/suspicious/noFallthroughSwitchClause: intentional
2728
target = domain;
2829
default: {
2930
if (/(ggpht|googleusercontent).com$/.test(domain)) {

reddit.com/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function run_it(node = document) {
4646
const sections = location.pathname.split(/(?!^)\//);
4747
const loc = sections[0];
4848
if (["/user", "/r"].includes(loc)) {
49-
[...node.querySelectorAll("a")].forEach((element) => {
49+
for (const element of node.querySelectorAll("a")) {
5050
const href = element.getAttribute("href");
5151
if (!href) {
5252
return;
@@ -113,7 +113,7 @@ function run_it(node = document) {
113113
'url("https://upload.wikimedia.org/wikipedia/commons/0/0f/External-link-ltr-icon_Dark.png")';
114114
element.style.paddingRight = "11px";
115115
}
116-
});
116+
}
117117
}
118118
node.marked = true;
119119
}

util.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ export const onBrowse = (doit) => {
88
window.onpopstate = doit;
99

1010
// https://stackoverflow.com/a/64927639/270302
11-
["pushState", "replaceState"].forEach((type) => {
11+
for (const type of ["pushState", "replaceState"]) {
1212
window.history[type] = new Proxy(window.history[type], {
1313
apply: (target, thisarg, argarray) => {
1414
doit();
1515
return target.apply(thisarg, argarray);
1616
},
1717
});
18-
});
18+
}
1919

2020
doit();
2121
};

0 commit comments

Comments
 (0)