mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-22 22:14:06 +02:00
enable and fix no-unused-vars and no-async-promise-executor (#17070)
* dev: set --no-bail for lint task * lint: enable no-async-promise-executor lint and fix them * lint: enable no-unused-vars with allowing _ prefix * lint: fix semi
This commit is contained in:
@@ -36,7 +36,7 @@ export async function lookupUser() {
|
||||
notFound();
|
||||
}
|
||||
});
|
||||
idPromise.then(show).catch(err => {
|
||||
idPromise.then(show).catch(_ => {
|
||||
notFound();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export function checkWordMute(note: Misskey.entities.Note, me: Misskey.entities.
|
||||
|
||||
try {
|
||||
return new RegExp(regexp[1], regexp[2]).test(text);
|
||||
} catch (err) {
|
||||
} catch (_) {
|
||||
// This should never happen due to input sanitisation.
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -180,8 +180,9 @@ export function chooseFileFromPcAndUpload(
|
||||
export function chooseDriveFile(options: {
|
||||
multiple?: boolean;
|
||||
} = {}): Promise<Misskey.entities.DriveFile[]> {
|
||||
return new Promise(async resolve => {
|
||||
const { dispose } = await os.popupAsyncWithDialog(import('@/components/MkDriveFileSelectDialog.vue').then(x => x.default), {
|
||||
return new Promise((resolve, rej) => {
|
||||
let dispose: () => void;
|
||||
os.popupAsyncWithDialog(import('@/components/MkDriveFileSelectDialog.vue').then(x => x.default), {
|
||||
multiple: options.multiple ?? false,
|
||||
}, {
|
||||
done: files => {
|
||||
@@ -190,7 +191,7 @@ export function chooseDriveFile(options: {
|
||||
}
|
||||
},
|
||||
closed: () => dispose(),
|
||||
});
|
||||
}).then((d) => dispose = d.dispose, rej);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -301,14 +302,15 @@ export async function createCroppedImageDriveFileFromImageDriveFile(imageDriveFi
|
||||
}
|
||||
|
||||
export async function selectDriveFolder(initialFolder: Misskey.entities.DriveFolder['id'] | null): Promise<(Misskey.entities.DriveFolder | null)[]> {
|
||||
return new Promise(async resolve => {
|
||||
const { dispose } = await os.popupAsyncWithDialog(import('@/components/MkDriveFolderSelectDialog.vue').then(x => x.default), {
|
||||
return new Promise((resolve, reject) => {
|
||||
let dispose: () => void;
|
||||
os.popupAsyncWithDialog(import('@/components/MkDriveFolderSelectDialog.vue').then(x => x.default), {
|
||||
initialFolder,
|
||||
}, {
|
||||
done: folders => {
|
||||
resolve(folders);
|
||||
},
|
||||
closed: () => dispose(),
|
||||
});
|
||||
}).then(d => dispose = d.dispose, reject);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -75,20 +75,18 @@ export async function readDataTransferItems(itemList: DataTransferItemList): Pro
|
||||
});
|
||||
}
|
||||
|
||||
function readDirectory(fileSystemDirectoryEntry: FileSystemDirectoryEntry): Promise<DroppedItem[]> {
|
||||
return new Promise(async (resolve) => {
|
||||
const allEntries = Array.of<FileSystemEntry>();
|
||||
const reader = fileSystemDirectoryEntry.createReader();
|
||||
while (true) {
|
||||
const entries = await new Promise<FileSystemEntry[]>((res, rej) => reader.readEntries(res, rej));
|
||||
if (entries.length === 0) {
|
||||
break;
|
||||
}
|
||||
allEntries.push(...entries);
|
||||
async function readDirectory(fileSystemDirectoryEntry: FileSystemDirectoryEntry): Promise<DroppedItem[]> {
|
||||
const allEntries = Array.of<FileSystemEntry>();
|
||||
const reader = fileSystemDirectoryEntry.createReader();
|
||||
while (true) {
|
||||
const entries = await new Promise<FileSystemEntry[]>((res, rej) => reader.readEntries(res, rej));
|
||||
if (entries.length === 0) {
|
||||
break;
|
||||
}
|
||||
allEntries.push(...entries);
|
||||
}
|
||||
|
||||
resolve(await Promise.all(allEntries.map(readEntry)));
|
||||
});
|
||||
return await Promise.all(allEntries.map(readEntry));
|
||||
}
|
||||
|
||||
// 扱いにくいので配列に変換
|
||||
|
||||
@@ -89,7 +89,7 @@ async function deleteFile(file: Misskey.entities.DriveFile) {
|
||||
}
|
||||
|
||||
export function getDriveFileMenu(file: Misskey.entities.DriveFile, folder?: Misskey.entities.DriveFolder | null): MenuItem[] {
|
||||
const isImage = file.type.startsWith('image/');
|
||||
const _isImage = file.type.startsWith('image/');
|
||||
|
||||
const menuItems: MenuItem[] = [];
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ export function getNoteMenu(props: {
|
||||
os.apiWithDialog('clips/remove-note', { clipId: props.currentClip.id, noteId: appearNote.id });
|
||||
}
|
||||
|
||||
async function promote(): Promise<void> {
|
||||
async function _promote(): Promise<void> {
|
||||
const { canceled, result: days } = await os.inputNumber({
|
||||
title: i18n.ts.numberOfDays,
|
||||
});
|
||||
|
||||
@@ -201,7 +201,7 @@ export class ImageFrameRenderer {
|
||||
qrSize,
|
||||
);
|
||||
qrImageBitmap.close();
|
||||
} catch (err) {
|
||||
} catch (_) {
|
||||
// nop
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ export class Paginator<
|
||||
} : {}),
|
||||
};
|
||||
|
||||
const apiRes = (await misskeyApi(this.endpoint, data).catch(err => {
|
||||
const apiRes = (await misskeyApi(this.endpoint, data).catch(_ => {
|
||||
this.error.value = true;
|
||||
this.fetching.value = false;
|
||||
return null;
|
||||
@@ -273,7 +273,7 @@ export class Paginator<
|
||||
}),
|
||||
};
|
||||
|
||||
const apiRes = (await misskeyApi<T[]>(this.endpoint, data).catch(err => {
|
||||
const apiRes = (await misskeyApi<T[]>(this.endpoint, data).catch(_ => {
|
||||
return null;
|
||||
})) as T[] | null;
|
||||
|
||||
@@ -326,7 +326,7 @@ export class Paginator<
|
||||
}),
|
||||
};
|
||||
|
||||
const apiRes = (await misskeyApi<T[]>(this.endpoint, data).catch(err => {
|
||||
const apiRes = (await misskeyApi<T[]>(this.endpoint, data).catch(_ => {
|
||||
return null;
|
||||
})) as T[] | null;
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ export async function loadAudio(url: string, options?: { useCache?: boolean; })
|
||||
|
||||
try {
|
||||
response = await window.fetch(url);
|
||||
} catch (err) {
|
||||
} catch (_) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ export function makeDateGroupedTimelineComputedRef<T extends { id: string; creat
|
||||
for (let i = 0; i < items.value.length; i++) {
|
||||
const item = items.value[i];
|
||||
const date = new Date(item.createdAt);
|
||||
const nextDate = items.value[i + 1] ? new Date(items.value[i + 1].createdAt) : null;
|
||||
const _nextDate = items.value[i + 1] ? new Date(items.value[i + 1].createdAt) : null;
|
||||
|
||||
if (tl.length === 0 || (
|
||||
span === 'day' && tl[tl.length - 1].date.getTime() !== date.getTime()
|
||||
|
||||
@@ -13,7 +13,7 @@ type TourStep = {
|
||||
};
|
||||
|
||||
export function startTour(steps: TourStep[]) {
|
||||
return new Promise<void>(async (resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
const currentStepIndex = ref(0);
|
||||
const titleRef = ref(steps[0].title);
|
||||
const descriptionRef = ref(steps[0].description);
|
||||
|
||||
Reference in New Issue
Block a user