chore: fix linting (#544)

* fix: eslint (server)

* fix: eslint (client)

* commit package lock file

* fix linting
This commit is contained in:
Philip Okugbe
2024-12-09 14:51:31 +00:00
committed by GitHub
parent e6bf4cdd6c
commit 532001fd82
22 changed files with 1076 additions and 245 deletions

View File

@ -1,4 +1,4 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { customAlphabet } = require('fix-esm').require('nanoid');
const alphabet = '0123456789abcdefghijklmnopqrstuvwxyz';

View File

@ -52,7 +52,7 @@ export class AttachmentService {
// passing attachmentId to allow for updating diagrams
// instead of creating new files for each save
if (opts?.attachmentId) {
let existingAttachment = await this.attachmentRepo.findById(
const existingAttachment = await this.attachmentRepo.findById(
opts.attachmentId,
);
if (!existingAttachment) {

View File

@ -24,7 +24,9 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
try {
accessToken = JSON.parse(req.cookies?.authTokens)?.accessToken;
} catch {}
} catch {
throw new BadRequestException('Failed to parse access token');
}
return accessToken || this.extractTokenFromHeader(req);
},

View File

@ -5,7 +5,8 @@ import { InjectKysely } from 'nestjs-kysely';
import { KyselyDB } from '@docmost/db/types/kysely.types';
import { sql } from 'kysely';
import { PageRepo } from '@docmost/db/repos/page/page.repo';
// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-require-imports
const tsquery = require('pg-tsquery')();
@Injectable()

View File

@ -33,13 +33,13 @@ export async function executeWithPagination<O, DB, TB extends keyof DB>(
.select((eb) => eb.ref(deferredJoinPrimaryKey).as('primaryKey'))
.execute()
// @ts-expect-error TODO: Fix the type here later
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
.then((rows) => rows.map((row) => row.primaryKey));
qb = qb
.where((eb) =>
primaryKeys.length > 0
? // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
?
eb(deferredJoinPrimaryKey, 'in', primaryKeys as any)
: eb(sql`1`, '=', 0),
)

View File

@ -42,7 +42,7 @@ export class ExportService {
content: [{ type: 'text', text: getPageTitle(page.title) }],
};
let prosemirrorJson: any = getProsemirrorContent(page.content);
const prosemirrorJson: any = getProsemirrorContent(page.content);
if (page.title) {
prosemirrorJson.content.unshift(titleNode);

View File

@ -25,7 +25,7 @@ export const mailDriverConfigProvider = {
const driver = environmentService.getMailDriver().toLocaleLowerCase();
switch (driver) {
case MailOption.SMTP:
case MailOption.SMTP: {
let auth = undefined;
if (
environmentService.getSmtpUsername() &&
@ -44,9 +44,10 @@ export const mailDriverConfigProvider = {
connectionTimeout: 30 * 1000, // 30 seconds
auth,
secure: environmentService.getSmtpSecure(),
ignoreTLS: environmentService.getSmtpIgnoreTLS()
ignoreTLS: environmentService.getSmtpIgnoreTLS(),
} as SMTPTransport.Options,
};
}
case MailOption.Postmark:
return {

View File

@ -41,7 +41,7 @@ export const storageDriverConfigProvider = {
};
case StorageOption.S3:
const s3Config = {
{ const s3Config = {
driver,
config: {
region: environmentService.getAwsS3Region(),
@ -68,7 +68,7 @@ export const storageDriverConfigProvider = {
};
}
return s3Config;
return s3Config; }
default:
throw new Error(`Unknown storage driver: ${driver}`);