style: fix linter and add types

This commit is contained in:
Juan D. Jara
2021-09-27 02:35:10 +02:00
parent eea389879f
commit 54868fd486
4 changed files with 11 additions and 12 deletions

View File

@@ -1,4 +1,5 @@
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';
import MailMessage from 'nodemailer/lib/mailer/mail-message';
import * as openpgp from 'openpgp'; import * as openpgp from 'openpgp';
import { Transform, TransformCallback } from 'stream'; import { Transform, TransformCallback } from 'stream';
@@ -25,7 +26,7 @@ class PGPEncryptor extends Transform {
// just save the whole message // just save the whole message
_transform = ( _transform = (
chunk: any, chunk: Uint8Array,
_encoding: BufferEncoding, _encoding: BufferEncoding,
callback: TransformCallback callback: TransformCallback
): void => { ): void => {
@@ -166,17 +167,16 @@ class PGPEncryptor extends Transform {
} }
export const openpgpEncrypt = (options: EncryptorOptions) => { export const openpgpEncrypt = (options: EncryptorOptions) => {
return function (mail: any, callback: () => unknown): void { return function (mail: MailMessage, callback: () => unknown): void {
if (!options.encryptionKeys.length) { if (!options.encryptionKeys.length) {
setImmediate(callback); setImmediate(callback);
} }
mail.message.transform( mail.message.transform(
() => new PGPEncryptor({
new PGPEncryptor({ signingKey: options.signingKey,
signingKey: options.signingKey, password: options.password,
password: options.password, encryptionKeys: options.encryptionKeys,
encryptionKeys: options.encryptionKeys, })
})
); );
setImmediate(callback); setImmediate(callback);
}; };

View File

@@ -40,7 +40,7 @@ class AsyncLock {
public dispatch = async ( public dispatch = async (
key: string | number, key: string | number,
callback: () => Promise<void> callback: () => Promise<void>
) => { ): Promise<void> => {
const skey = String(key); const skey = String(key);
await this.acquire(skey); await this.acquire(skey);
try { try {

View File

@@ -3,7 +3,7 @@ import { useState } from 'react';
import AnimateHeight from 'react-animate-height'; import AnimateHeight from 'react-animate-height';
export interface AccordionProps { export interface AccordionProps {
children: (args: AccordionChildProps) => React.ReactElement<any, any> | null; children: (args: AccordionChildProps) => React.ReactElement | null;
/** If true, only one accordion item can be open at any time */ /** If true, only one accordion item can be open at any time */
single?: boolean; single?: boolean;
/** If true, at least one accordion item will always be open */ /** If true, at least one accordion item will always be open */
@@ -13,7 +13,7 @@ export interface AccordionProps {
export interface AccordionChildProps { export interface AccordionChildProps {
openIndexes: number[]; openIndexes: number[];
handleClick(index: number): void; handleClick(index: number): void;
AccordionContent: any; AccordionContent: typeof AccordionContent;
} }
export const AccordionContent: React.FC<{ isOpen: boolean }> = ({ export const AccordionContent: React.FC<{ isOpen: boolean }> = ({

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-async-promise-executor */
import axios, { AxiosError, AxiosResponse } from 'axios'; import axios, { AxiosError, AxiosResponse } from 'axios';
interface JellyfinAuthenticationResult { interface JellyfinAuthenticationResult {