forked from mirrors/misskey
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:
@@ -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
|
||||
|
||||
@@ -205,7 +205,7 @@ export class AnnouncementService {
|
||||
announcementId: announcementId,
|
||||
userId: user.id,
|
||||
});
|
||||
} catch (e) {
|
||||
} catch (_) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -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':
|
||||
|
||||
@@ -366,7 +366,7 @@ export class EmailService {
|
||||
valid: true,
|
||||
reason: null,
|
||||
};
|
||||
} catch (error) {
|
||||
} catch (_) {
|
||||
return {
|
||||
valid: false,
|
||||
reason: 'network',
|
||||
|
||||
@@ -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))
|
||||
.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);
|
||||
});
|
||||
});
|
||||
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({ resolveWithObject: true });
|
||||
return blurhash.encode(new Uint8ClampedArray(buffer), info.width, info.height, 5, 5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (_) {
|
||||
// TODO: log error
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -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 [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(_ => {});
|
||||
})();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
@@ -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 (_) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user