Skip to content

Commit fd9b851

Browse files
committed
style: deno lint
1 parent 9cc726b commit fd9b851

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

browser/dom/click.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ export const holdDown = async (
5353
target: element,
5454
clientX: options.X,
5555
clientY: options.Y,
56-
pageX: options.X + window.scrollX,
57-
pageY: options.Y + window.scrollY,
56+
pageX: options.X + globalThis.scrollX,
57+
pageY: options.Y + globalThis.scrollY,
5858
});
5959
const mouseOptions = {
6060
button: options.button ?? 0,

browser/dom/extractCodeFiles.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { extractCodeFiles } from "./extractCodeFiles.ts";
22
import { Line } from "../../deps/scrapbox.ts";
33
import { assertSnapshot } from "../../deps/testing.ts";
4-
import sample from "./sample-lines1.json" assert { type: "json" };
4+
import sample from "./sample-lines1.json" with { type: "json" };
55

66
Deno.test("extractCodeFiles", async (t) => {
77
await assertSnapshot(

browser/dom/isHeightViewable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
export const isHeightViewable = (element: HTMLElement): boolean => {
66
const { top, bottom } = element.getBoundingClientRect();
7-
return top >= 0 && bottom <= window.innerHeight;
7+
return top >= 0 && bottom <= globalThis.innerHeight;
88
};

browser/dom/motion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ const getVisibleLineCount = (): number => {
161161
if (clientHeight === undefined) {
162162
throw Error("Could not find .line:last-of-type");
163163
}
164-
return Math.round(window.innerHeight / clientHeight);
164+
return Math.round(globalThis.innerHeight / clientHeight);
165165
};
166166

167167
/** 半ページ上にスクロールする

browser/dom/open.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ export const open = (
5858
options?.newTab !== false &&
5959
(options?.newTab === true || project !== scrapbox.Project.name)
6060
) {
61-
window.open(url);
61+
globalThis.open(url);
6262
return;
6363
}
6464
if (
6565
options?.reload !== false &&
6666
(options?.reload === true || project !== scrapbox.Project.name)
6767
) {
68-
window.open(url, "_self");
68+
globalThis.open(url, "_self");
6969
return;
7070
}
7171

rest/auth.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { BaseOptions } from "./util.ts";
33

44
// scrapbox.io内なら`window._csrf`にCSRF tokenが入っている
55
declare global {
6-
interface Window {
7-
_csrf?: string;
8-
}
6+
// globalThisに変数を宣言するには、`var`を使うしかない
7+
// deno-lint-ignore no-var
8+
var _csrf: string | undefined;
99
}
1010

1111
/** HTTP headerのCookieに入れる文字列を作る
@@ -21,7 +21,7 @@ export const cookie = (sid: string): string => `connect.sid=${sid}`;
2121
export const getCSRFToken = async (
2222
init?: BaseOptions,
2323
): Promise<string> => {
24-
if (window._csrf) return window._csrf;
24+
if (globalThis._csrf) return globalThis._csrf;
2525

2626
const user = await getProfile(init);
2727
return user.csrfToken;

0 commit comments

Comments
 (0)