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:
anatawa12 2026-01-08 11:49:12 +09:00 committed by GitHub
parent cf89c4e363
commit 666f78e676
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
144 changed files with 324 additions and 354 deletions

View File

@ -39,7 +39,7 @@
"migrateandstart": "pnpm migrate && pnpm start",
"watch": "pnpm dev",
"dev": "node scripts/dev.mjs",
"lint": "pnpm -r lint",
"lint": "pnpm --no-bail -r lint",
"cy:open": "pnpm cypress open --config-file=cypress.config.ts",
"cy:run": "pnpm cypress run",
"e2e": "pnpm start-server-and-test start:test http://localhost:61812 cy:run",

View File

@ -9,7 +9,7 @@ window.onload = async () => {
const account = JSON.parse(localStorage.getItem('account'));
const i = account.token;
const api = (endpoint, data = {}) => {
const _api = (endpoint, data = {}) => {
const promise = new Promise((resolve, reject) => {
// Append a credential
if (i) data.i = i;

View File

@ -25,7 +25,6 @@ export default [
},
},
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'import/order': ['warn', {
groups: [
'builtin',

View File

@ -16,24 +16,22 @@ async function connectToPostgres() {
}
async function connectToRedis(redisOptions) {
return await new Promise(async (resolve, reject) => {
const redis = new Redis({
let redis;
try {
redis = new Redis({
...redisOptions,
lazyConnect: true,
reconnectOnError: false,
showFriendlyErrorStack: true,
});
redis.on('error', e => reject(e));
try {
await redis.connect();
resolve();
} catch (e) {
reject(e);
await Promise.race([
new Promise((_, reject) => redis.on('error', e => reject(e))),
redis.connect(),
]);
} finally {
redis.disconnect(false);
}
});
}
// If not all of these are defined, the default one gets reused.

View File

@ -58,7 +58,7 @@ export async function masterMain() {
//await connectDb();
if (config.pidFile) fs.writeFileSync(config.pidFile, process.pid.toString());
} catch (e) {
bootLogger.error('Fatal error occurred during initialization', null, true);
bootLogger.error('Fatal error occurred during initialization: ' + e, null, true);
process.exit(1);
}

View File

@ -352,7 +352,7 @@ export function loadConfig(): Config {
function tryCreateUrl(url: string) {
try {
return new URL(url);
} catch (e) {
} catch (_) {
throw new Error(`url="${url}" is not a valid URL.`);
}
}

View File

@ -75,7 +75,7 @@ export class AccountMoveService {
*/
@bindThis
public async moveFromLocal(src: MiLocalUser, dst: MiLocalUser | MiRemoteUser): Promise<unknown> {
const srcUri = this.userEntityService.getUserUri(src);
const _srcUri = this.userEntityService.getUserUri(src);
const dstUri = this.userEntityService.getUserUri(dst);
// add movedToUri to indicate that the user has moved

View File

@ -205,7 +205,7 @@ export class AnnouncementService {
announcementId: announcementId,
userId: user.id,
});
} catch (e) {
} catch (_) {
return;
}

View File

@ -39,7 +39,7 @@ export class AvatarDecorationService implements OnApplicationShutdown {
const obj = JSON.parse(data);
if (obj.channel === 'internal') {
const { type, body } = obj.message as GlobalEvents['internal']['payload'];
const { type, body: _ } = obj.message as GlobalEvents['internal']['payload'];
switch (type) {
case 'avatarDecorationCreated':
case 'avatarDecorationUpdated':

View File

@ -366,7 +366,7 @@ export class EmailService {
valid: true,
reason: null,
};
} catch (error) {
} catch (_) {
return {
valid: false,
reason: 'network',

View File

@ -484,25 +484,13 @@ export class FileInfoService {
* Calculate blurhash string of image
*/
@bindThis
private getBlurhash(path: string, type: string): Promise<string> {
return new Promise(async (resolve, reject) => {
(await sharpBmp(path, type))
private async getBlurhash(path: string, type: string): Promise<string> {
const sharp = await sharpBmp(path, type);
const { data: buffer, info } = await sharp
.raw()
.ensureAlpha()
.resize(64, 64, { fit: 'inside' })
.toBuffer((err, buffer, info) => {
if (err) return reject(err);
let hash;
try {
hash = blurhash.encode(new Uint8ClampedArray(buffer), info.width, info.height, 5, 5);
} catch (e) {
return reject(e);
}
resolve(hash);
});
});
.toBuffer({ resolveWithObject: true });
return blurhash.encode(new Uint8ClampedArray(buffer), info.width, info.height, 5, 5);
}
}

View File

@ -308,7 +308,7 @@ export class MfmService {
try {
const date = new Date(parseInt(text, 10) * 1000);
return `<time datetime="${escapeHtml(date.toISOString())}">${escapeHtml(date.toISOString())}</time>`;
} catch (err) {
} catch (_) {
return fnDefault(node);
}
}
@ -376,7 +376,7 @@ export class MfmService {
try {
const url = new URL(node.props.url);
return `<a href="${escapeHtml(url.href)}">${toHtml(node.children)}</a>`;
} catch (err) {
} catch (_) {
return `[${toHtml(node.children)}](${escapeHtml(node.props.url)})`;
}
},
@ -390,7 +390,7 @@ export class MfmService {
try {
const url = new URL(href);
return `<a href="${escapeHtml(url.href)}" class="u-url mention">${escapeHtml(acct)}</a>`;
} catch (err) {
} catch (_) {
return escapeHtml(acct);
}
},
@ -419,7 +419,7 @@ export class MfmService {
try {
const url = new URL(node.props.url);
return `<a href="${escapeHtml(url.href)}">${escapeHtml(node.props.url)}</a>`;
} catch (err) {
} catch (_) {
return escapeHtml(node.props.url);
}
},

View File

@ -187,9 +187,9 @@ export class NoteDraftService {
}
//#region visibleUsers
let visibleUsers: MiUser[] = [];
let _visibleUsers: MiUser[] = [];
if (data.visibleUserIds != null && data.visibleUserIds.length > 0) {
visibleUsers = await this.usersRepository.findBy({
_visibleUsers = await this.usersRepository.findBy({
id: In(data.visibleUserIds),
});
}

View File

@ -314,7 +314,7 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
default:
return false;
}
} catch (err) {
} catch (_) {
// TODO: log error
return false;
}

View File

@ -190,8 +190,7 @@ export class SearchService {
return this.searchNoteByMeiliSearch(q, me, opts, pagination);
}
default: {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const typeCheck: never = this.provider;
const _: never = this.provider;
return [];
}
}

View File

@ -49,8 +49,8 @@ export class UserSuspendService {
});
(async () => {
await this.postSuspend(user).catch(e => {});
await this.unFollowAll(user).catch(e => {});
await this.postSuspend(user).catch(_ => {});
await this.unFollowAll(user).catch(_ => {});
})();
}
@ -67,7 +67,7 @@ export class UserSuspendService {
});
(async () => {
await this.postUnsuspend(user).catch(e => {});
await this.postUnsuspend(user).catch(_ => {});
})();
}

View File

@ -98,7 +98,7 @@ export class UtilityService {
try {
// TODO: RE2インスタンスをキャッシュ
return new RE2(regexp[1], regexp[2]).test(text);
} catch (err) {
} catch (_) {
// This should never happen due to input sanitisation.
return false;
}

View File

@ -515,7 +515,7 @@ export class ApRendererService {
const restPart = maybeUrl.slice(match[0].length);
return `<a href="${urlPartParsed.href}" rel="me nofollow noopener" target="_blank">${urlPart}</a>${restPart}`;
} catch (e) {
} catch (_) {
return maybeUrl;
}
};

View File

@ -226,7 +226,7 @@ export class ApRequestService {
return await this.signedGet(href, user, allowSoftfail, false);
}
}
} catch (e) {
} catch (_) {
// something went wrong parsing the HTML, ignore the whole thing
}
}

View File

@ -138,7 +138,7 @@ export class ChatEntityService {
const reactions: { reaction: string; }[] = [];
for (const record of message.reactions) {
const [userId, reaction] = record.split('/');
const [, reaction] = record.split('/');
reactions.push({
reaction,
});

View File

@ -55,13 +55,13 @@ export class MetaEntityService {
if (instance.defaultLightTheme) {
try {
defaultLightTheme = JSON.stringify(JSON5.parse(instance.defaultLightTheme));
} catch (e) {
} catch (_) {
}
}
if (instance.defaultDarkTheme) {
try {
defaultDarkTheme = JSON.stringify(JSON5.parse(instance.defaultDarkTheme));
} catch (e) {
} catch (_) {
}
}

View File

@ -54,7 +54,7 @@ export class NoteReactionEntityService implements OnModuleInit {
packedUser?: Packed<'UserLite'>
},
): Promise<Packed<'NoteReaction'>> {
const opts = Object.assign({
const _opts = Object.assign({
}, options);
const reaction = typeof src === 'object' ? src : await this.noteReactionsRepository.findOneByOrFail({ id: src });
@ -90,7 +90,7 @@ export class NoteReactionEntityService implements OnModuleInit {
packedUser?: Packed<'UserLite'>
},
): Promise<Packed<'NoteReactionWithNote'>> {
const opts = Object.assign({
const _opts = Object.assign({
}, options);
const reaction = typeof src === 'object' ? src : await this.noteReactionsRepository.findOneByOrFail({ id: src });

View File

@ -56,7 +56,7 @@ export async function checkWordMute(note: NoteLike, me: UserLike | null | undefi
try {
return new RE2(regexp[1], regexp[2]).test(text);
} catch (err) {
} catch (_) {
// This should never happen due to input sanitisation.
return false;
}

View File

@ -12,7 +12,7 @@ export function getIpHash(ip: string): string {
// (this means for IPv4 the entire address is used)
const prefix = IPCIDR.createAddress(ip).mask(64);
return 'ip-' + BigInt('0b' + prefix).toString(36);
} catch (e) {
} catch (_) {
const prefix = IPCIDR.createAddress(ip.replace(/:[0-9]+$/, '')).mask(64);
return 'ip-' + BigInt('0b' + prefix).toString(36);
}

View File

@ -26,7 +26,7 @@ export class I18n<T extends Record<string, any>> {
}
}
return str;
} catch (e) {
} catch (_) {
console.warn(`missing localization '${key}'`);
return key;
}

View File

@ -262,8 +262,6 @@ type ObjectSchemaTypeDef<p extends Schema> =
never :
any;
type ObjectSchemaType<p extends Schema> = NullOrUndefined<p, ObjectSchemaTypeDef<p>>;
export type SchemaTypeDef<p extends Schema> =
p['type'] extends 'null' ? null :
p['type'] extends 'integer' ? number :

View File

@ -67,7 +67,7 @@ export class MiAbuseReportNotificationRecipient {
/**
* .
*/
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn({ name: 'userId', referencedColumnName: 'id', foreignKeyConstraintName: 'FK_abuse_report_notification_recipient_userId1' })
@ -76,7 +76,7 @@ export class MiAbuseReportNotificationRecipient {
/**
* .
*/
@ManyToOne(type => MiUserProfile, {
@ManyToOne(() => MiUserProfile, {
onDelete: 'CASCADE',
})
@JoinColumn({ name: 'userId', referencedColumnName: 'userId', foreignKeyConstraintName: 'FK_abuse_report_notification_recipient_userId2' })
@ -96,7 +96,7 @@ export class MiAbuseReportNotificationRecipient {
/**
* Webhook.
*/
@ManyToOne(type => MiSystemWebhook, {
@ManyToOne(() => MiSystemWebhook, {
onDelete: 'CASCADE',
})
@JoinColumn({ name: 'systemWebhookId', referencedColumnName: 'id', foreignKeyConstraintName: 'FK_abuse_report_notification_recipient_systemWebhookId' })

View File

@ -18,7 +18,7 @@ export class MiAbuseUserReport {
@Column(id())
public targetUserId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -28,7 +28,7 @@ export class MiAbuseUserReport {
@Column(id())
public reporterId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -40,7 +40,7 @@ export class MiAbuseUserReport {
})
public assigneeId: MiUser['id'] | null;
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'SET NULL',
})
@JoinColumn()

View File

@ -41,7 +41,7 @@ export class MiAccessToken {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -53,7 +53,7 @@ export class MiAccessToken {
})
public appId: MiApp['id'] | null;
@ManyToOne(type => MiApp, {
@ManyToOne(() => MiApp, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -79,7 +79,7 @@ export class MiAnnouncement {
})
public userId: MiUser['id'] | null;
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -18,7 +18,7 @@ export class MiAnnouncementRead {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -28,7 +28,7 @@ export class MiAnnouncementRead {
@Column(id())
public announcementId: MiAnnouncement['id'];
@ManyToOne(type => MiAnnouncement, {
@ManyToOne(() => MiAnnouncement, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -24,7 +24,7 @@ export class MiAntenna {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -45,7 +45,7 @@ export class MiAntenna {
})
public userListId: MiUserList['id'] | null;
@ManyToOne(type => MiUserList, {
@ManyToOne(() => MiUserList, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -20,7 +20,7 @@ export class MiApp {
})
public userId: MiUser['id'] | null;
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'SET NULL',
nullable: true,
})

View File

@ -25,7 +25,7 @@ export class MiAuthSession {
})
public userId: MiUser['id'] | null;
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
nullable: true,
})
@ -35,7 +35,7 @@ export class MiAuthSession {
@Column(id())
public appId: MiApp['id'];
@ManyToOne(type => MiApp, {
@ManyToOne(() => MiApp, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -20,7 +20,7 @@ export class MiBlocking {
})
public blockeeId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -33,7 +33,7 @@ export class MiBlocking {
})
public blockerId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -18,7 +18,7 @@ export class MiBubbleGameRecord {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -27,7 +27,7 @@ export class MiChannel {
})
public userId: MiUser['id'] | null;
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'SET NULL',
})
@JoinColumn()
@ -52,7 +52,7 @@ export class MiChannel {
})
public bannerId: MiDriveFile['id'] | null;
@ManyToOne(type => MiDriveFile, {
@ManyToOne(() => MiDriveFile, {
onDelete: 'SET NULL',
})
@JoinColumn()

View File

@ -20,7 +20,7 @@ export class MiChannelFavorite {
})
public channelId: MiChannel['id'];
@ManyToOne(type => MiChannel, {
@ManyToOne(() => MiChannel, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -32,7 +32,7 @@ export class MiChannelFavorite {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -21,7 +21,7 @@ export class MiChannelFollowing {
})
public followeeId: MiChannel['id'];
@ManyToOne(type => MiChannel, {
@ManyToOne(() => MiChannel, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -34,7 +34,7 @@ export class MiChannelFollowing {
})
public followerId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -20,7 +20,7 @@ export class MiChannelMuting {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -32,7 +32,7 @@ export class MiChannelMuting {
})
public channelId: MiChannel['id'];
@ManyToOne(type => MiChannel, {
@ManyToOne(() => MiChannel, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -19,7 +19,7 @@ export class MiChatApproval {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -31,7 +31,7 @@ export class MiChatApproval {
})
public otherId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -20,7 +20,7 @@ export class MiChatMessage {
})
public fromUserId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -32,7 +32,7 @@ export class MiChatMessage {
})
public toUserId: MiUser['id'] | null;
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -44,7 +44,7 @@ export class MiChatMessage {
})
public toRoomId: MiChatRoom['id'] | null;
@ManyToOne(type => MiChatRoom, {
@ManyToOne(() => MiChatRoom, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -72,7 +72,7 @@ export class MiChatMessage {
})
public fileId: MiDriveFile['id'] | null;
@ManyToOne(type => MiDriveFile, {
@ManyToOne(() => MiDriveFile, {
onDelete: 'SET NULL',
})
@JoinColumn()

View File

@ -23,7 +23,7 @@ export class MiChatRoom {
})
public ownerId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -20,7 +20,7 @@ export class MiChatRoomInvitation {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -32,7 +32,7 @@ export class MiChatRoomInvitation {
})
public roomId: MiChatRoom['id'];
@ManyToOne(type => MiChatRoom, {
@ManyToOne(() => MiChatRoom, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -20,7 +20,7 @@ export class MiChatRoomMembership {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -32,7 +32,7 @@ export class MiChatRoomMembership {
})
public roomId: MiChatRoom['id'];
@ManyToOne(type => MiChatRoom, {
@ManyToOne(() => MiChatRoom, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -25,7 +25,7 @@ export class MiClip {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -18,7 +18,7 @@ export class MiClipFavorite {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -27,7 +27,7 @@ export class MiClipFavorite {
@Column(id())
public clipId: MiClip['id'];
@ManyToOne(type => MiClip, {
@ManyToOne(() => MiClip, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -21,7 +21,7 @@ export class MiClipNote {
})
public noteId: MiNote['id'];
@ManyToOne(type => MiNote, {
@ManyToOne(() => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -34,7 +34,7 @@ export class MiClipNote {
})
public clipId: MiClip['id'];
@ManyToOne(type => MiClip, {
@ManyToOne(() => MiClip, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -22,7 +22,7 @@ export class MiDriveFile {
})
public userId: MiUser['id'] | null;
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'SET NULL',
})
@JoinColumn()
@ -142,7 +142,7 @@ export class MiDriveFile {
})
public folderId: MiDriveFolder['id'] | null;
@ManyToOne(type => MiDriveFolder, {
@ManyToOne(() => MiDriveFolder, {
onDelete: 'SET NULL',
})
@JoinColumn()

View File

@ -26,7 +26,7 @@ export class MiDriveFolder {
})
public userId: MiUser['id'] | null;
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -40,7 +40,7 @@ export class MiDriveFolder {
})
public parentId: MiDriveFolder['id'] | null;
@ManyToOne(type => MiDriveFolder, {
@ManyToOne(() => MiDriveFolder, {
onDelete: 'SET NULL',
})
@JoinColumn()

View File

@ -38,7 +38,7 @@ export class MiFlash {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -18,7 +18,7 @@ export class MiFlashLike {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -27,7 +27,7 @@ export class MiFlashLike {
@Column(id())
public flashId: MiFlash['id'];
@ManyToOne(type => MiFlash, {
@ManyToOne(() => MiFlash, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -20,7 +20,7 @@ export class MiFollowRequest {
})
public followeeId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -33,7 +33,7 @@ export class MiFollowRequest {
})
public followerId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -21,7 +21,7 @@ export class MiFollowing {
})
public followeeId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -34,7 +34,7 @@ export class MiFollowing {
})
public followerId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -18,7 +18,7 @@ export class MiGalleryLike {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -27,7 +27,7 @@ export class MiGalleryLike {
@Column(id())
public postId: MiGalleryPost['id'];
@ManyToOne(type => MiGalleryPost, {
@ManyToOne(() => MiGalleryPost, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -36,7 +36,7 @@ export class MiGalleryPost {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -21,7 +21,7 @@ export class MiMeta {
})
public rootUserId: MiUser['id'] | null;
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'SET NULL',
nullable: true,
})

View File

@ -16,7 +16,7 @@ export class MiModerationLog {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -26,7 +26,7 @@ export class MiMuting {
})
public muteeId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -39,7 +39,7 @@ export class MiMuting {
})
public muterId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -35,7 +35,7 @@ export class MiNote {
})
public replyId: MiNote['id'] | null;
@ManyToOne(type => MiNote, {
@ManyToOne(() => MiNote, {
createForeignKeyConstraints: false,
})
@JoinColumn()
@ -49,7 +49,7 @@ export class MiNote {
})
public renoteId: MiNote['id'] | null;
@ManyToOne(type => MiNote, {
@ManyToOne(() => MiNote, {
createForeignKeyConstraints: false,
})
@JoinColumn()
@ -83,7 +83,7 @@ export class MiNote {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -208,7 +208,7 @@ export class MiNote {
})
public channelId: MiChannel['id'] | null;
@ManyToOne(type => MiChannel, {
@ManyToOne(() => MiChannel, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -27,7 +27,7 @@ export class MiNoteDraft {
public replyId: MiNote['id'] | null;
// There is a possibility that replyId is not null but reply is null when the reply note is deleted.
@ManyToOne(type => MiNote, {
@ManyToOne(() => MiNote, {
createForeignKeyConstraints: false,
})
@JoinColumn()
@ -42,7 +42,7 @@ export class MiNoteDraft {
public renoteId: MiNote['id'] | null;
// There is a possibility that renoteId is not null but renote is null when the renote note is deleted.
@ManyToOne(type => MiNote, {
@ManyToOne(() => MiNote, {
createForeignKeyConstraints: false,
})
@JoinColumn()
@ -66,7 +66,7 @@ export class MiNoteDraft {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -120,7 +120,7 @@ export class MiNoteDraft {
// There is a possibility that channelId is not null but channel is null when the channel is deleted.
// (deleting channel is not implemented so it's not happening now but may happen in the future)
@ManyToOne(type => MiChannel, {
@ManyToOne(() => MiChannel, {
createForeignKeyConstraints: false,
})
@JoinColumn()

View File

@ -18,7 +18,7 @@ export class MiNoteFavorite {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -27,7 +27,7 @@ export class MiNoteFavorite {
@Column(id())
public noteId: MiNote['id'];
@ManyToOne(type => MiNote, {
@ManyToOne(() => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -18,7 +18,7 @@ export class MiNoteReaction {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -28,7 +28,7 @@ export class MiNoteReaction {
@Column(id())
public noteId: MiNote['id'];
@ManyToOne(type => MiNote, {
@ManyToOne(() => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -19,7 +19,7 @@ export class MiNoteThreadMuting {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -56,7 +56,7 @@ export class MiPage {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -68,7 +68,7 @@ export class MiPage {
})
public eyeCatchingImageId: MiDriveFile['id'] | null;
@ManyToOne(type => MiDriveFile, {
@ManyToOne(() => MiDriveFile, {
onDelete: 'SET NULL',
})
@JoinColumn()

View File

@ -18,7 +18,7 @@ export class MiPageLike {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -27,7 +27,7 @@ export class MiPageLike {
@Column(id())
public pageId: MiPage['id'];
@ManyToOne(type => MiPage, {
@ManyToOne(() => MiPage, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -24,7 +24,7 @@ export class MiPasswordResetRequest {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -15,7 +15,7 @@ export class MiPoll {
@PrimaryColumn(id())
public noteId: MiNote['id'];
@OneToOne(type => MiNote, {
@OneToOne(() => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -18,7 +18,7 @@ export class MiPollVote {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -28,7 +28,7 @@ export class MiPollVote {
@Column(id())
public noteId: MiNote['id'];
@ManyToOne(type => MiNote, {
@ManyToOne(() => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -13,7 +13,7 @@ export class MiPromoNote {
@PrimaryColumn(id())
public noteId: MiNote['id'];
@OneToOne(type => MiNote, {
@OneToOne(() => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -18,7 +18,7 @@ export class MiPromoRead {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -27,7 +27,7 @@ export class MiPromoRead {
@Column(id())
public noteId: MiNote['id'];
@ManyToOne(type => MiNote, {
@ManyToOne(() => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -23,7 +23,7 @@ export class MiRegistrationTicket {
})
public expiresAt: Date | null;
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -36,7 +36,7 @@ export class MiRegistrationTicket {
})
public createdById: MiUser['id'] | null;
@OneToOne(type => MiUser, {
@OneToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -25,7 +25,7 @@ export class MiRegistryItem {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -20,7 +20,7 @@ export class MiRenoteMuting {
})
public muteeId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -33,7 +33,7 @@ export class MiRenoteMuting {
})
public muterId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -27,7 +27,7 @@ export class MiReversiGame {
@Column(id())
public user1Id: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -36,7 +36,7 @@ export class MiReversiGame {
@Column(id())
public user2Id: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -21,7 +21,7 @@ export class MiRoleAssignment {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -34,7 +34,7 @@ export class MiRoleAssignment {
})
public roleId: MiRole['id'];
@ManyToOne(type => MiRole, {
@ManyToOne(() => MiRole, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -16,7 +16,7 @@ export class MiSignin {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -16,7 +16,7 @@ export class MiSwSubscription {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -18,7 +18,7 @@ export class MiSystemAccount {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -99,7 +99,7 @@ export class MiUser {
})
public avatarId: MiDriveFile['id'] | null;
@OneToOne(type => MiDriveFile, {
@OneToOne(() => MiDriveFile, {
onDelete: 'SET NULL',
})
@JoinColumn()
@ -112,7 +112,7 @@ export class MiUser {
})
public bannerId: MiDriveFile['id'] | null;
@OneToOne(type => MiDriveFile, {
@OneToOne(() => MiDriveFile, {
onDelete: 'SET NULL',
})
@JoinColumn()

View File

@ -12,7 +12,7 @@ export class MiUserKeypair {
@PrimaryColumn(id())
public userId: MiUser['id'];
@OneToOne(type => MiUser, {
@OneToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -25,7 +25,7 @@ export class MiUserList {
})
public isPublic: boolean;
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -18,7 +18,7 @@ export class MiUserListFavorite {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -27,7 +27,7 @@ export class MiUserListFavorite {
@Column(id())
public userListId: MiUserList['id'];
@ManyToOne(type => MiUserList, {
@ManyToOne(() => MiUserList, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -21,7 +21,7 @@ export class MiUserListMembership {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -34,7 +34,7 @@ export class MiUserListMembership {
})
public userListId: MiUserList['id'];
@ManyToOne(type => MiUserList, {
@ManyToOne(() => MiUserList, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -20,7 +20,7 @@ export class MiUserMemo {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -33,7 +33,7 @@ export class MiUserMemo {
})
public targetUserId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -18,7 +18,7 @@ export class MiUserNotePining {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -27,7 +27,7 @@ export class MiUserNotePining {
@Column(id())
public noteId: MiNote['id'];
@ManyToOne(type => MiNote, {
@ManyToOne(() => MiNote, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -17,7 +17,7 @@ export class MiUserProfile {
@PrimaryColumn(id())
public userId: MiUser['id'];
@OneToOne(type => MiUser, {
@OneToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()
@ -215,7 +215,7 @@ export class MiUserProfile {
})
public pinnedPageId: MiPage['id'] | null;
@OneToOne(type => MiPage, {
@OneToOne(() => MiPage, {
onDelete: 'SET NULL',
})
@JoinColumn()

View File

@ -12,7 +12,7 @@ export class MiUserPublickey {
@PrimaryColumn(id())
public userId: MiUser['id'];
@OneToOne(type => MiUser, {
@OneToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -18,7 +18,7 @@ export class MiUserSecurityKey {
@Column(id())
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -22,7 +22,7 @@ export class MiWebhook {
})
public userId: MiUser['id'];
@ManyToOne(type => MiUser, {
@ManyToOne(() => MiUser, {
onDelete: 'CASCADE',
})
@JoinColumn()

View File

@ -123,8 +123,8 @@ export class ExportCustomEmojisProcessorService {
metaStream.end();
// Create archive
await new Promise<void>(async (resolve) => {
const [archivePath, archiveCleanup] = await createTemp();
await new Promise<void>((resolve) => {
const archiveStream = fs.createWriteStream(archivePath);
const archive = archiver('zip', {
zlib: { level: 0 },

View File

@ -63,7 +63,7 @@ export class PostScheduledNoteProcessorService {
this.notificationService.createNotification(draft.userId, 'scheduledNotePosted', {
noteId: note.id,
});
} catch (err) {
} catch (_) {
this.notificationService.createNotification(draft.userId, 'scheduledNotePostFailed', {
noteDraftId: draft.id,
});

View File

@ -116,7 +116,7 @@ export class ActivityPubServerService {
try {
signature = httpSignature.parseRequest(request.raw, { 'headers': ['(request-target)', 'host', 'date'], authorizationHeaderName: 'signature' });
} catch (e) {
} catch (_) {
reply.code(401);
return;
}

View File

@ -48,8 +48,6 @@ export class NodeinfoServerService {
@bindThis
public createServer(fastify: FastifyInstance, options: FastifyPluginOptions, done: (err?: Error) => void) {
const nodeinfo2 = async (version: number) => {
const now = Date.now();
const notesChart = await this.notesChart.getChart('hour', 1, null);
const localPosts = notesChart.local.total[0];

View File

@ -426,7 +426,7 @@ export class ApiCallService implements OnApplicationShutdown {
if (['boolean', 'number', 'integer'].includes(param.type ?? '') && typeof data[k] === 'string') {
try {
data[k] = JSON.parse(data[k]);
} catch (e) {
} catch (_) {
throw new ApiError({
message: 'Invalid param.',
code: 'INVALID_PARAM',

View File

@ -231,7 +231,7 @@ export class SigninApiService {
try {
await this.userAuthService.twoFactorAuthenticate(profile, token);
} catch (e) {
} catch (_) {
return await fail(403, {
id: 'cdf1235b-ac71-46d4-a3a6-84ccce48df6f',
});

View File

@ -93,7 +93,7 @@ export class SigninWithPasskeyApiService {
// Not more than 1 API call per 250ms and not more than 100 attempts per 30min
// NOTE: 1 Sign-in require 2 API calls
await this.rateLimiterService.limit({ key: 'signin-with-passkey', duration: 60 * 30 * 1000, max: 200, minInterval: 250 }, getIpHash(request.ip));
} catch (err) {
} catch (_) {
reply.code(429);
return {
error: {

View File

@ -255,7 +255,7 @@ export class SignupApiService {
throw new FastifyReplyError(400, 'EXPIRED');
}
const { account, secret } = await this.signupService.signup({
const { account } = await this.signupService.signup({
username: pendingUser.username,
passwordHash: pendingUser.password,
});

View File

@ -111,7 +111,7 @@ export class StreamingApiServerService {
user: MiLocalUser | null;
app: MiAccessToken | null
}) => {
const { stream, user, app } = ctx;
const { stream, user } = ctx;
const ev = new EventEmitter();

View File

@ -72,7 +72,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private announcementService: AnnouncementService,
) {
super(meta, paramDef, async (ps, me) => {
const { raw, packed } = await this.announcementService.create({
const { packed } = await this.announcementService.create({
updatedAt: null,
title: ps.title,
text: ps.text,

Some files were not shown because too many files have changed in this diff Show More