lint fixes

This commit is contained in:
syuilo 2025-03-29 16:09:27 +09:00
parent 6c2c3f08be
commit d9d796b204
16 changed files with 37 additions and 43 deletions

View File

@ -3,19 +3,17 @@
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
/* eslint-disable @typescript-eslint/explicit-function-return-type */
/* eslint-disable import/no-default-export */
import type { StoryObj } from '@storybook/vue3';
import { HttpResponse, http } from 'msw'; import { HttpResponse, http } from 'msw';
import { action } from '@storybook/addon-actions'; import { action } from '@storybook/addon-actions';
import { expect, userEvent, within } from '@storybook/test'; import { expect, userEvent, within } from '@storybook/test';
import { channel } from '../../.storybook/fakes.js'; import { channel } from '../../.storybook/fakes.js';
import { commonHandlers } from '../../.storybook/mocks.js'; import { commonHandlers } from '../../.storybook/mocks.js';
import MkChannelFollowButton from './MkChannelFollowButton.vue'; import MkChannelFollowButton from './MkChannelFollowButton.vue';
import type { StoryObj } from '@storybook/vue3';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
function sleep(ms: number) { function sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => window.setTimeout(resolve, ms));
} }
export const Default = { export const Default = {

View File

@ -3,17 +3,15 @@
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
/* eslint-disable @typescript-eslint/explicit-function-return-type */
/* eslint-disable import/no-default-export */
import type { StoryObj } from '@storybook/vue3';
import { HttpResponse, http } from 'msw'; import { HttpResponse, http } from 'msw';
import { action } from '@storybook/addon-actions'; import { action } from '@storybook/addon-actions';
import { expect, userEvent, within } from '@storybook/test'; import { expect, userEvent, within } from '@storybook/test';
import { commonHandlers } from '../../.storybook/mocks.js'; import { commonHandlers } from '../../.storybook/mocks.js';
import MkClickerGame from './MkClickerGame.vue'; import MkClickerGame from './MkClickerGame.vue';
import type { StoryObj } from '@storybook/vue3';
function sleep(ms: number) { function sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => window.setTimeout(resolve, ms));
} }
export const Default = { export const Default = {

View File

@ -79,7 +79,7 @@ function opening() {
picker.value?.focus(); picker.value?.focus();
// //
setTimeout(() => { window.setTimeout(() => {
picker.value?.focus(); picker.value?.focus();
}, 10); }, 10);
} }

View File

@ -339,7 +339,7 @@ const bufferedDataRatio = computed(() => {
// MediaControl Events // MediaControl Events
function onMouseOver() { function onMouseOver() {
if (controlStateTimer) { if (controlStateTimer) {
clearTimeout(controlStateTimer); window.clearTimeout(controlStateTimer);
} }
isHoverring.value = true; isHoverring.value = true;
} }

View File

@ -82,11 +82,11 @@ function moveBySystem(to: number): Promise<void> {
return; return;
} }
const startTime = Date.now(); const startTime = Date.now();
let intervalId = setInterval(() => { let intervalId = window.setInterval(() => {
const time = Date.now() - startTime; const time = Date.now() - startTime;
if (time > RELEASE_TRANSITION_DURATION) { if (time > RELEASE_TRANSITION_DURATION) {
pullDistance.value = to; pullDistance.value = to;
clearInterval(intervalId); window.clearInterval(intervalId);
r(); r();
return; return;
} }

View File

@ -3,10 +3,9 @@
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
/* eslint-disable @typescript-eslint/explicit-function-return-type */
import { waitFor } from '@storybook/test'; import { waitFor } from '@storybook/test';
import type { StoryObj } from '@storybook/vue3';
import MkPageHeader from './MkPageHeader.vue'; import MkPageHeader from './MkPageHeader.vue';
import type { StoryObj } from '@storybook/vue3';
export const Empty = { export const Empty = {
render(args) { render(args) {
return { return {
@ -29,7 +28,7 @@ export const Empty = {
}; };
}, },
async play() { async play() {
const wait = new Promise((resolve) => setTimeout(resolve, 800)); const wait = new Promise((resolve) => window.setTimeout(resolve, 800));
await waitFor(async () => await wait); await waitFor(async () => await wait);
}, },
args: { args: {

View File

@ -133,7 +133,7 @@ async function enter(el: Element) {
entering = false; entering = false;
}); });
setTimeout(renderTab, 170); window.setTimeout(renderTab, 170);
} }
function afterEnter(el: Element) { function afterEnter(el: Element) {

View File

@ -50,6 +50,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref, toRefs, watch } from 'vue'; import { computed, onMounted, ref, toRefs, watch } from 'vue';
import type { DataSource, GridSetting, GridState, Size } from '@/components/grid/grid.js';
import type { CellAddress, CellValue, GridCell } from '@/components/grid/cell.js';
import type { GridContext, GridEvent } from '@/components/grid/grid-event.js';
import type { GridColumn } from '@/components/grid/column.js';
import type { GridRow, GridRowSetting } from '@/components/grid/row.js';
import type { MenuItem } from '@/types/menu.js';
import { GridEventEmitter } from '@/components/grid/grid.js'; import { GridEventEmitter } from '@/components/grid/grid.js';
import MkDataRow from '@/components/grid/MkDataRow.vue'; import MkDataRow from '@/components/grid/MkDataRow.vue';
import MkHeaderRow from '@/components/grid/MkHeaderRow.vue'; import MkHeaderRow from '@/components/grid/MkHeaderRow.vue';
@ -68,13 +74,6 @@ import { createColumn } from '@/components/grid/column.js';
import { createRow, defaultGridRowSetting, resetRow } from '@/components/grid/row.js'; import { createRow, defaultGridRowSetting, resetRow } from '@/components/grid/row.js';
import { handleKeyEvent } from '@/utility/key-event.js'; import { handleKeyEvent } from '@/utility/key-event.js';
import type { DataSource, GridSetting, GridState, Size } from '@/components/grid/grid.js';
import type { CellAddress, CellValue, GridCell } from '@/components/grid/cell.js';
import type { GridContext, GridEvent } from '@/components/grid/grid-event.js';
import type { GridColumn } from '@/components/grid/column.js';
import type { GridRow, GridRowSetting } from '@/components/grid/row.js';
import type { MenuItem } from '@/types/menu.js';
type RowHolder = { type RowHolder = {
row: GridRow, row: GridRow,
cells: GridCell[], cells: GridCell[],
@ -130,7 +129,7 @@ const bus = new GridEventEmitter();
* *
* @see {@link onResize} * @see {@link onResize}
*/ */
const resizeObserver = new ResizeObserver((entries) => setTimeout(() => onResize(entries))); const resizeObserver = new ResizeObserver((entries) => window.setTimeout(() => onResize(entries)));
const rootEl = ref<InstanceType<typeof HTMLTableElement>>(); const rootEl = ref<InstanceType<typeof HTMLTableElement>>();
/** /**

View File

@ -145,13 +145,13 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, onActivated, onDeactivated, onMounted, onUnmounted, ref, shallowRef, triggerRef, watch } from 'vue'; import { computed, onActivated, onDeactivated, onMounted, onUnmounted, ref, shallowRef, triggerRef, watch } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import * as Reversi from 'misskey-reversi'; import * as Reversi from 'misskey-reversi';
import { useInterval } from '@@/js/use-interval.js';
import { url } from '@@/js/config.js';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import MkFolder from '@/components/MkFolder.vue'; import MkFolder from '@/components/MkFolder.vue';
import MkSwitch from '@/components/MkSwitch.vue'; import MkSwitch from '@/components/MkSwitch.vue';
import { deepClone } from '@/utility/clone.js'; import { deepClone } from '@/utility/clone.js';
import { useInterval } from '@@/js/use-interval.js';
import { ensureSignin } from '@/i.js'; import { ensureSignin } from '@/i.js';
import { url } from '@@/js/config.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { misskeyApi } from '@/utility/misskey-api.js'; import { misskeyApi } from '@/utility/misskey-api.js';
import { userPage } from '@/filters/user.js'; import { userPage } from '@/filters/user.js';
@ -424,7 +424,7 @@ function autoplay() {
const tick = () => { const tick = () => {
const log = logs[i]; const log = logs[i];
const time = log.time - previousLog.time; const time = log.time - previousLog.time;
setTimeout(() => { window.setTimeout(() => {
i++; i++;
logPos.value++; logPos.value++;
previousLog = log; previousLog = log;

View File

@ -786,7 +786,7 @@ function testNotification(): void {
smashCount = 0; smashCount = 0;
} }
if (smashTimer) { if (smashTimer) {
clearTimeout(smashTimer); window.clearTimeout(smashTimer);
} }
smashTimer = window.setTimeout(() => { smashTimer = window.setTimeout(() => {
smashCount = 0; smashCount = 0;

View File

@ -497,7 +497,7 @@ export async function claimAchievement(type: typeof ACHIEVEMENT_TYPES[number]) {
if (claimedAchievements.includes(type)) return; if (claimedAchievements.includes(type)) return;
claimingQueue.add(type); claimingQueue.add(type);
claimedAchievements.push(type); claimedAchievements.push(type);
await new Promise(resolve => setTimeout(resolve, (claimingQueue.size - 1) * 500)); await new Promise(resolve => window.setTimeout(resolve, (claimingQueue.size - 1) * 500));
window.setTimeout(() => { window.setTimeout(() => {
claimingQueue.delete(type); claimingQueue.delete(type);
}, 500); }, 500);

View File

@ -15,11 +15,11 @@ export function confetti(options: { duration?: number; } = {}) {
return Math.random() * (max - min) + min; return Math.random() * (max - min) + min;
} }
const interval = setInterval(() => { const interval = window.setInterval(() => {
const timeLeft = animationEnd - Date.now(); const timeLeft = animationEnd - Date.now();
if (timeLeft <= 0) { if (timeLeft <= 0) {
return clearInterval(interval); return window.clearInterval(interval);
} }
const particleCount = 50 * (timeLeft / duration); const particleCount = 50 * (timeLeft / duration);

View File

@ -2,7 +2,7 @@
* SPDX-FileCopyrightText: syuilo and misskey-project * SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import { getHTMLElementOrNull } from "@/utility/get-dom-node-or-null.js"; import { getHTMLElementOrNull } from '@/utility/get-dom-node-or-null.js';
//#region types //#region types
export type Keymap = Record<string, CallbackFunction | CallbackObject>; export type Keymap = Record<string, CallbackFunction | CallbackObject>;
@ -136,7 +136,7 @@ let lastHotKeyStoreTimer: number | null = null;
const storePattern = (ev: KeyboardEvent, callback: CallbackFunction) => { const storePattern = (ev: KeyboardEvent, callback: CallbackFunction) => {
if (lastHotKeyStoreTimer != null) { if (lastHotKeyStoreTimer != null) {
clearTimeout(lastHotKeyStoreTimer); window.clearTimeout(lastHotKeyStoreTimer);
} }
latestHotkey = { latestHotkey = {

View File

@ -5,7 +5,7 @@
const requestIdleCallback: typeof globalThis.requestIdleCallback = globalThis.requestIdleCallback ?? ((callback) => { const requestIdleCallback: typeof globalThis.requestIdleCallback = globalThis.requestIdleCallback ?? ((callback) => {
const start = performance.now(); const start = performance.now();
const timeoutId = setTimeout(() => { const timeoutId = window.setTimeout(() => {
callback({ callback({
didTimeout: false, // polyfill でタイムアウト発火することはない didTimeout: false, // polyfill でタイムアウト発火することはない
timeRemaining() { timeRemaining() {
@ -17,7 +17,7 @@ const requestIdleCallback: typeof globalThis.requestIdleCallback = globalThis.re
return timeoutId; return timeoutId;
}); });
const cancelIdleCallback: typeof globalThis.cancelIdleCallback = globalThis.cancelIdleCallback ?? ((timeoutId) => { const cancelIdleCallback: typeof globalThis.cancelIdleCallback = globalThis.cancelIdleCallback ?? ((timeoutId) => {
clearTimeout(timeoutId); window.clearTimeout(timeoutId);
}); });
class IdlingRenderScheduler { class IdlingRenderScheduler {

View File

@ -158,7 +158,7 @@ export async function playMisskeySfxFile(soundStore: SoundStore): Promise<boolea
canPlay = false; canPlay = false;
return await playMisskeySfxFileInternal(soundStore).finally(() => { return await playMisskeySfxFileInternal(soundStore).finally(() => {
// ごく短時間に音が重複しないように // ごく短時間に音が重複しないように
setTimeout(() => { window.setTimeout(() => {
canPlay = true; canPlay = true;
}, 25); }, 25);
}); });
@ -230,10 +230,10 @@ export async function getSoundDuration(file: string): Promise<number> {
const audioEl = window.document.createElement('audio'); const audioEl = window.document.createElement('audio');
audioEl.src = file; audioEl.src = file;
return new Promise((resolve) => { return new Promise((resolve) => {
const si = setInterval(() => { const si = window.setInterval(() => {
if (audioEl.readyState > 0) { if (audioEl.readyState > 0) {
resolve(audioEl.duration * 1000); resolve(audioEl.duration * 1000);
clearInterval(si); window.clearInterval(si);
audioEl.remove(); audioEl.remove();
} }
}, 100); }, 100);

View File

@ -5,5 +5,5 @@
export async function tick(): Promise<void> { export async function tick(): Promise<void> {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
await new Promise((globalThis.requestIdleCallback ?? setTimeout) as never); await new Promise((globalThis.requestIdleCallback ?? window.setTimeout) as never);
} }