mirror of
https://github.com/sim1222/misskey.git
synced 2025-08-03 23:16:28 +09:00
fix lint errors
This commit is contained in:
@ -20,7 +20,7 @@ type SimpleUserInfo = {
|
||||
};
|
||||
|
||||
type Params<T extends IEndpointMeta> = {
|
||||
[P in keyof T['params']]: NonNullable<T['params']>[P]['transform'] extends Function
|
||||
[P in keyof T['params']]: NonNullable<T['params']>[P]['transform'] extends () => any
|
||||
? ReturnType<NonNullable<T['params']>[P]['transform']>
|
||||
: NonNullable<T['params']>[P]['default'] extends null | number | string
|
||||
? NonOptional<ReturnType<NonNullable<T['params']>[P]['validator']['get']>[0]>
|
||||
@ -30,7 +30,7 @@ type Params<T extends IEndpointMeta> = {
|
||||
export type Response = Record<string, any> | void;
|
||||
|
||||
type executor<T extends IEndpointMeta> =
|
||||
(params: Params<T>, user: T['requireCredential'] extends true ? SimpleUserInfo : SimpleUserInfo | null, token: AccessToken | null, file?: any, cleanup?: Function) =>
|
||||
(params: Params<T>, user: T['requireCredential'] extends true ? SimpleUserInfo : SimpleUserInfo | null, token: AccessToken | null, file?: any, cleanup?: () => any) =>
|
||||
Promise<T['res'] extends undefined ? Response : SchemaType<NonNullable<T['res']>>>;
|
||||
|
||||
export default function <T extends IEndpointMeta>(meta: T, cb: executor<T>)
|
||||
@ -74,7 +74,7 @@ function getParams<T extends IEndpointMeta>(defs: T, params: any): [Params<T>, A
|
||||
});
|
||||
return true;
|
||||
} else {
|
||||
if (v === undefined && def.hasOwnProperty('default')) {
|
||||
if (v === undefined && Object.prototype.hasOwnProperty.call(def, 'default')) {
|
||||
x[k] = def.default;
|
||||
} else {
|
||||
x[k] = v;
|
||||
|
@ -69,7 +69,7 @@ export default define(meta, async (ps, me) => {
|
||||
throw new ApiError(meta.errors.accessDenied);
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:no-unnecessary-initializer
|
||||
// eslint:disable-next-line:no-unnecessary-initializer
|
||||
let banner = undefined;
|
||||
if (ps.bannerId != null) {
|
||||
banner = await DriveFiles.findOne({
|
||||
|
@ -75,7 +75,7 @@ export default define(meta, async (ps, user) => {
|
||||
|
||||
const flags = attestation.authData[32];
|
||||
|
||||
// tslint:disable-next-line:no-bitwise
|
||||
// eslint:disable-next-line:no-bitwise
|
||||
if (!(flags & 1)) {
|
||||
throw new Error('user not present');
|
||||
}
|
||||
|
@ -10,16 +10,16 @@ const logger = new Logger('limiter');
|
||||
export default (endpoint: IEndpoint, user: User) => new Promise<void>((ok, reject) => {
|
||||
const limitation = endpoint.meta.limit!;
|
||||
|
||||
const key = limitation.hasOwnProperty('key')
|
||||
const key = Object.prototype.hasOwnProperty.call(limitation, 'key')
|
||||
? limitation.key
|
||||
: endpoint.name;
|
||||
|
||||
const hasShortTermLimit =
|
||||
limitation.hasOwnProperty('minInterval');
|
||||
Object.prototype.hasOwnProperty.call(limitation, 'minInterval');
|
||||
|
||||
const hasLongTermLimit =
|
||||
limitation.hasOwnProperty('duration') &&
|
||||
limitation.hasOwnProperty('max');
|
||||
Object.prototype.hasOwnProperty.call(limitation, 'duration') &&
|
||||
Object.prototype.hasOwnProperty.call(limitation, 'max');
|
||||
|
||||
if (hasShortTermLimit) {
|
||||
min();
|
||||
|
@ -19,7 +19,7 @@ export default class extends Channel {
|
||||
@autobind
|
||||
public async onMessage(type: string, body: any) {
|
||||
switch (type) {
|
||||
case 'ping':
|
||||
case 'ping': {
|
||||
if (body.id == null) return;
|
||||
const matching = await ReversiMatchings.findOne({
|
||||
parentId: this.user!.id,
|
||||
@ -28,6 +28,7 @@ export default class extends Channel {
|
||||
if (matching == null) return;
|
||||
publishMainStream(matching.childId, 'reversiInvited', await ReversiMatchings.pack(matching, { id: matching.childId }));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ export interface BroadcastTypes {
|
||||
}
|
||||
|
||||
export interface UserStreamTypes {
|
||||
terminate: {};
|
||||
terminate: Record<string, unknown>;
|
||||
followChannel: Channel;
|
||||
unfollowChannel: Channel;
|
||||
updateUserProfile: UserProfile;
|
||||
|
Reference in New Issue
Block a user