From 54868fd4861bd678a7f5884ba41b8716c9f68ba6 Mon Sep 17 00:00:00 2001 From: "Juan D. Jara" Date: Mon, 27 Sep 2021 02:35:10 +0200 Subject: [PATCH] style: fix linter and add types --- server/lib/email/openpgpEncrypt.ts | 16 ++++++++-------- server/utils/asyncLock.ts | 2 +- src/components/Common/Accordion/index.tsx | 4 ++-- src/utils/jellyfin.ts | 1 - 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/server/lib/email/openpgpEncrypt.ts b/server/lib/email/openpgpEncrypt.ts index 263f2b1f..5189df83 100644 --- a/server/lib/email/openpgpEncrypt.ts +++ b/server/lib/email/openpgpEncrypt.ts @@ -1,4 +1,5 @@ import { randomBytes } from 'crypto'; +import MailMessage from 'nodemailer/lib/mailer/mail-message'; import * as openpgp from 'openpgp'; import { Transform, TransformCallback } from 'stream'; @@ -25,7 +26,7 @@ class PGPEncryptor extends Transform { // just save the whole message _transform = ( - chunk: any, + chunk: Uint8Array, _encoding: BufferEncoding, callback: TransformCallback ): void => { @@ -166,17 +167,16 @@ class PGPEncryptor extends Transform { } export const openpgpEncrypt = (options: EncryptorOptions) => { - return function (mail: any, callback: () => unknown): void { + return function (mail: MailMessage, callback: () => unknown): void { if (!options.encryptionKeys.length) { setImmediate(callback); } mail.message.transform( - () => - new PGPEncryptor({ - signingKey: options.signingKey, - password: options.password, - encryptionKeys: options.encryptionKeys, - }) + new PGPEncryptor({ + signingKey: options.signingKey, + password: options.password, + encryptionKeys: options.encryptionKeys, + }) ); setImmediate(callback); }; diff --git a/server/utils/asyncLock.ts b/server/utils/asyncLock.ts index 51794a98..630f7df3 100644 --- a/server/utils/asyncLock.ts +++ b/server/utils/asyncLock.ts @@ -40,7 +40,7 @@ class AsyncLock { public dispatch = async ( key: string | number, callback: () => Promise - ) => { + ): Promise => { const skey = String(key); await this.acquire(skey); try { diff --git a/src/components/Common/Accordion/index.tsx b/src/components/Common/Accordion/index.tsx index 67e883fe..e4a02da9 100644 --- a/src/components/Common/Accordion/index.tsx +++ b/src/components/Common/Accordion/index.tsx @@ -3,7 +3,7 @@ import { useState } from 'react'; import AnimateHeight from 'react-animate-height'; export interface AccordionProps { - children: (args: AccordionChildProps) => React.ReactElement | null; + children: (args: AccordionChildProps) => React.ReactElement | null; /** If true, only one accordion item can be open at any time */ single?: boolean; /** If true, at least one accordion item will always be open */ @@ -13,7 +13,7 @@ export interface AccordionProps { export interface AccordionChildProps { openIndexes: number[]; handleClick(index: number): void; - AccordionContent: any; + AccordionContent: typeof AccordionContent; } export const AccordionContent: React.FC<{ isOpen: boolean }> = ({ diff --git a/src/utils/jellyfin.ts b/src/utils/jellyfin.ts index 1458243e..2bf78dbf 100644 --- a/src/utils/jellyfin.ts +++ b/src/utils/jellyfin.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-async-promise-executor */ import axios, { AxiosError, AxiosResponse } from 'axios'; interface JellyfinAuthenticationResult {