lint fixes

This commit is contained in:
syuilo 2025-03-20 19:00:09 +09:00
parent c02f0b3b33
commit 6015254e59
71 changed files with 160 additions and 160 deletions

View file

@ -50,7 +50,7 @@ function releaseFocusTrap(el: HTMLElement): void {
const highestZIndexElement = getHighestZIndexElement();
if (el.parentElement != null && el !== document.body) {
if (el.parentElement != null && el !== window.document.body) {
el.parentElement.childNodes.forEach((siblingNode) => {
const siblingEl = getHTMLElementOrNull(siblingNode);
if (!siblingEl) return;
@ -104,7 +104,7 @@ export function focusTrap(el: HTMLElement, hasInteractionWithOtherFocusTrappedEl
el.inert = false;
}
if (el.parentElement != null && el !== document.body) {
if (el.parentElement != null && el !== window.document.body) {
el.parentElement.childNodes.forEach((siblingNode) => {
const siblingEl = getHTMLElementOrNull(siblingNode);
if (!siblingEl) return;

View file

@ -58,7 +58,7 @@ export const focusParent = (input: MaybeHTMLElement | null | undefined, self = f
const focusOrScroll = (element: HTMLElement, scroll: boolean) => {
if (scroll) {
const scrollContainer = getScrollContainer(element) ?? document.documentElement;
const scrollContainer = getScrollContainer(element) ?? window.document.documentElement;
const scrollContainerTop = getScrollPosition(scrollContainer);
const stickyTop = getStickyTop(element, scrollContainer);
const stickyBottom = getStickyBottom(element, scrollContainer);
@ -74,7 +74,7 @@ const focusOrScroll = (element: HTMLElement, scroll: boolean) => {
scrollContainer.scrollTo({ top: scrollTo, behavior: 'instant' });
}
if (document.activeElement !== element) {
if (window.document.activeElement !== element) {
element.focus({ preventScroll: true });
}
};

View file

@ -35,8 +35,8 @@ export const requestFullscreen = ({ videoEl, playerEl, options }: RequestFullscr
export const exitFullscreen = ({ videoEl }: ExitFullscreenProps) => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (document.exitFullscreen != null) {
document.exitFullscreen();
if (window.document.exitFullscreen != null) {
window.document.exitFullscreen();
return;
}
if (videoEl.webkitExitFullscreen != null) {

View file

@ -54,9 +54,9 @@ export const makeHotkey = (keymap: Keymap) => {
const actions = parseKeymap(keymap);
return (ev: KeyboardEvent) => {
if ('pswp' in window && window.pswp != null) return;
if (document.activeElement != null) {
if (IGNORE_ELEMENTS.includes(document.activeElement.tagName.toLowerCase())) return;
if (getHTMLElementOrNull(document.activeElement)?.isContentEditable) return;
if (window.document.activeElement != null) {
if (IGNORE_ELEMENTS.includes(window.document.activeElement.tagName.toLowerCase())) return;
if (getHTMLElementOrNull(window.document.activeElement)?.isContentEditable) return;
}
for (const action of actions) {
if (matchPatterns(ev, action)) {

View file

@ -50,7 +50,7 @@ export function initChart() {
);
// フォントカラー
Chart.defaults.color = getComputedStyle(document.documentElement).getPropertyValue('--MI_THEME-fg');
Chart.defaults.color = getComputedStyle(window.document.documentElement).getPropertyValue('--MI_THEME-fg');
Chart.defaults.borderColor = store.s.darkMode ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)';

View file

@ -28,7 +28,7 @@ export function physics(container: HTMLElement) {
// create renderer
const render = Matter.Render.create({
engine: engine,
//element: document.getElementById('debug'),
//element: window.document.getElementById('debug'),
options: {
width: containerWidth,
height: containerHeight,

View file

@ -25,7 +25,7 @@ export function chooseFileFromPc(
const nameConverter = options?.nameConverter ?? (() => undefined);
return new Promise((res, rej) => {
const input = document.createElement('input');
const input = window.document.createElement('input');
input.type = 'file';
input.multiple = multiple;
input.onchange = () => {

View file

@ -156,7 +156,7 @@ export class SnowfallEffect {
easing: 0.0005,
};
/**
* @throws {Error} - Thrown when it fails to get WebGL context for the canvas
* @throws {Error} - Thrown when it fails to get WebGL context for the canvas
*/
constructor(options: {
sakura?: boolean;
@ -172,7 +172,7 @@ export class SnowfallEffect {
const gl = canvas.getContext('webgl2', { antialias: true });
if (gl == null) throw new Error('Failed to get WebGL context');
document.body.append(canvas);
window.document.body.append(canvas);
this.canvas = canvas;
this.gl = gl;
@ -190,7 +190,7 @@ export class SnowfallEffect {
}
private initCanvas(): HTMLCanvasElement {
const canvas = document.createElement('canvas');
const canvas = window.document.createElement('canvas');
Object.assign(canvas.style, {
position: 'fixed',

View file

@ -226,7 +226,7 @@ export function createSourceNode(buffer: AudioBuffer, opts: {
* @param file URLIDではない
*/
export async function getSoundDuration(file: string): Promise<number> {
const audioEl = document.createElement('audio');
const audioEl = window.document.createElement('audio');
audioEl.src = file;
return new Promise((resolve) => {
const si = setInterval(() => {
@ -249,7 +249,7 @@ export function isMute(): boolean {
}
// noinspection RedundantIfStatementJS
if (prefer.s['sound.useSoundOnlyWhenActive'] && document.visibilityState === 'hidden') {
if (prefer.s['sound.useSoundOnlyWhenActive'] && window.document.visibilityState === 'hidden') {
// ブラウザがアクティブな時のみサウンドを出力する
return true;
}

View file

@ -18,7 +18,7 @@ export class StickySidebar {
this.container = container;
this.el = this.container.children[0] as HTMLElement;
this.el.style.position = 'sticky';
this.spacer = document.createElement('div');
this.spacer = window.document.createElement('div');
this.container.prepend(this.spacer);
this.marginTop = marginTop;
this.offsetTop = this.container.getBoundingClientRect().top;

View file

@ -6,7 +6,7 @@
let isWebpSupportedCache: boolean | undefined;
export function isWebpSupported() {
if (isWebpSupportedCache === undefined) {
const canvas = document.createElement('canvas');
const canvas = window.document.createElement('canvas');
canvas.width = 1;
canvas.height = 1;
isWebpSupportedCache = canvas.toDataURL('image/webp').startsWith('data:image/webp');