1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-14 11:05:47 +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:
anatawa12
2026-01-08 11:49:12 +09:00
committed by GitHub
parent cf89c4e363
commit 666f78e676
144 changed files with 324 additions and 354 deletions

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,

View File

@@ -76,7 +76,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
try {
// Create file
driveFile = await this.driveService.uploadFromUrl({ url: emoji.originalUrl, user: null, force: true });
} catch (e) {
} catch (_) {
// TODO: need to return Drive Error
throw new ApiError();
}

View File

@@ -117,7 +117,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
case 'SAME_NAME_EMOJI_EXISTS': throw new ApiError(meta.errors.sameNameEmojiExists);
}
// 網羅性チェック
const mustBeNever: never = error;
const _mustBeNever: never = error;
});
}
}

View File

@@ -215,7 +215,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
type: 'Note',
object,
};
} catch (e) {
} catch (_) {
return null;
}
}

View File

@@ -81,7 +81,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
try {
await this.userAuthService.twoFactorAuthenticate(profile, token);
} catch (e) {
} catch (_) {
throw new Error('authentication failed');
}
}

View File

@@ -212,7 +212,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
try {
await this.userAuthService.twoFactorAuthenticate(profile, token);
} catch (e) {
} catch (_) {
throw new Error('authentication failed');
}
}

View File

@@ -72,7 +72,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
try {
await this.userAuthService.twoFactorAuthenticate(profile, token);
} catch (e) {
} catch (_) {
throw new Error('authentication failed');
}
}

View File

@@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
try {
await this.userAuthService.twoFactorAuthenticate(profile, token);
} catch (e) {
} catch (_) {
throw new Error('authentication failed');
}
}

View File

@@ -57,7 +57,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
try {
await this.userAuthService.twoFactorAuthenticate(profile, token);
} catch (e) {
} catch (_) {
throw new Error('authentication failed');
}
}

View File

@@ -45,7 +45,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
try {
await this.userAuthService.twoFactorAuthenticate(profile, token);
} catch (e) {
} catch (_) {
throw new Error('authentication failed');
}
}

View File

@@ -49,7 +49,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
try {
await this.userAuthService.twoFactorAuthenticate(profile, token);
} catch (e) {
} catch (_) {
throw new Error('authentication failed');
}
}

View File

@@ -71,7 +71,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private notificationService: NotificationService,
) {
super(meta, paramDef, async (ps, me) => {
const EXTRA_LIMIT = 100;
const untilId = ps.untilId ?? (ps.untilDate ? this.idService.gen(ps.untilDate!) : undefined);
const sinceId = ps.sinceId ?? (ps.sinceDate ? this.idService.gen(ps.sinceDate!) : undefined);

View File

@@ -91,7 +91,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
try {
await this.userAuthService.twoFactorAuthenticate(profile, token);
} catch (e) {
} catch (_) {
throw new Error('authentication failed');
}
}

View File

@@ -323,7 +323,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
try {
new RE2(regexp[1], regexp[2]);
} catch (err) {
} catch (_) {
throw new ApiError(meta.errors.invalidRegexp);
}
}
@@ -587,7 +587,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
})
.execute();
}
} catch (err) {
} catch (_) {
// なにもしない
}
}

View File

@@ -59,7 +59,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw err;
});
const mutedNotes = await this.notesRepository.find({
const _mutedNotes = await this.notesRepository.find({
where: [{
id: note.threadId ?? note.id,
}, {

View File

@@ -155,7 +155,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
birthday.shift(); // 年の部分を削除
// なぜか get_birthday_date() = :birthday だとインデックスが効かないので、BETWEEN で対応
query.andWhere('get_birthday_date(followeeProfile.birthday) BETWEEN :birthday AND :birthday', { birthday: parseInt(birthday.join('')) });
} catch (err) {
} catch (_) {
throw new ApiError(meta.errors.birthdayInvalid);
}
}

View File

@@ -9,9 +9,8 @@ import { refs } from '@/misc/json-schema.js';
export function convertSchemaToOpenApiSchema(schema: Schema, type: 'param' | 'res', includeSelfRef: boolean): any {
// optional, nullable, refはスキーマ定義に含まれないので分離しておく
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { optional, nullable, ref, selfRef, ..._res }: any = schema;
const res = deepClone(_res);
const { optional, nullable, ref, selfRef, ...res1 }: any = schema;
const res = deepClone(res1);
if (schema.type === 'object' && schema.properties) {
if (type === 'res') {

View File

@@ -139,7 +139,7 @@ export default class Connection {
try {
obj = JSON.parse(data.toString());
} catch (e) {
} catch (_) {
return;
}

View File

@@ -872,9 +872,6 @@ export class ClientServerService {
}));
});
const override = (source: string, target: string, depth = 0) =>
[, ...target.split('/').filter(x => x), ...source.split('/').filter(x => x).splice(depth)].join('/');
fastify.get('/flush', async (request, reply) => {
let sendHeader = true;