Skip to content

Commit aa699f9

Browse files
committed
Fix linting errors
1 parent 17f42a1 commit aa699f9

35 files changed

+36
-58
lines changed

src/api/v1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import basicAuth from '../middleware/basicAuth';
2929
import bearerAuth from '../middleware/bearerAuth';
3030
import refreshToken from '../middleware/refreshToken';
3131
import uploadImageProfile from '../middleware/uploadImageProfile';
32-
import uploadImagesMax from '../middleware/uploadImagesMax';
32+
// import uploadImagesMax from '../middleware/uploadImagesMax';
3333
import validRole from '../middleware/validateRole';
3434
import validTopic from '../middleware/validateTopic';
3535
import validateUserIdAdmin from '../middleware/validateUserIdAdmin';

src/middleware/allowAll.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NextFunction, Request, Response } from 'express';
2-
import { AccessControlRow, requestAccess } from '../utils/access';
2+
import { requestAccess } from '../utils/access';
33

44
const access = async (req: Request, res: Response, next: NextFunction) => {
55
res.locals.accessRegex = requestAccess();

src/middleware/basicAuth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const auth = async (req: Request, res: Response, next: NextFunction) => {
3737
if (!authorization) throw new AppError(errDef[401].AuthorizationNotFound);
3838

3939
const [scheme, cred] = authorization.split(' ');
40-
if (scheme != 'Basic') throw new AppError(errDef[401].InvalidAuthScheme);
40+
if (scheme !== 'Basic') throw new AppError(errDef[401].InvalidAuthScheme);
4141
if (!cred) throw new AppError(errDef[401].UserCredentialNotFound);
4242

4343
const { username, password } = decodeCredential(cred);

src/middleware/bearerAuth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const auth = async (req: Request, res: Response, next: NextFunction) => {
1515
if (!authorization) throw new AppError(errDef[401].AuthorizationNotFound);
1616

1717
const [scheme, accessToken] = authorization.split(' ');
18-
if (scheme != 'Bearer') throw new AppError(errDef[401].InvalidAuthScheme);
18+
if (scheme !== 'Bearer') throw new AppError(errDef[401].InvalidAuthScheme);
1919
if (!accessToken) throw new AppError(errDef[401].AccessTokenNotFound);
2020

2121
// Get regex from access control

src/middleware/uploadImageProfile.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const uploader = async (req: Request, res: Response, next: NextFunction) => {
2525
// create a dir
2626
try {
2727
await fs.promises.access(fileDir);
28-
} catch (error) {
28+
} catch (_error: any) {
2929
await fs.promises.mkdir(fileDir, { recursive: true });
3030
}
3131

@@ -63,7 +63,7 @@ const uploader = async (req: Request, res: Response, next: NextFunction) => {
6363
}
6464
});
6565

66-
bb.on('field', (fieldname: string, value: string, info: FieldInfo) => {
66+
bb.on('field', (fieldname: string, value: string, _info: FieldInfo) => {
6767
req.body[fieldname] = value;
6868
});
6969

@@ -87,6 +87,7 @@ const uploader = async (req: Request, res: Response, next: NextFunction) => {
8787
});
8888

8989
bb.on('close', () => {
90+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
9091
resultError ? next(resultError) : next();
9192
});
9293

src/middleware/uploadImagesMax.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const uploader =
2828
// create a dir
2929
try {
3030
await fs.promises.access(fileDir);
31-
} catch (error) {
31+
} catch (_error: any) {
3232
await fs.promises.mkdir(fileDir, { recursive: true });
3333
}
3434

@@ -66,7 +66,7 @@ const uploader =
6666
}
6767
});
6868

69-
bb.on('field', (fieldname: string, value: string, info: FieldInfo) => {
69+
bb.on('field', (fieldname: string, value: string, _info: FieldInfo) => {
7070
req.body[fieldname] = value;
7171
});
7272

@@ -89,6 +89,7 @@ const uploader =
8989
});
9090

9191
bb.on('close', () => {
92+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
9293
resultError ? next(resultError) : next();
9394
});
9495

src/middleware/validateUserIdAdmin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NextFunction, Request, Response } from 'express';
2-
import { JwtPayload } from 'jsonwebtoken';
2+
// import { JwtPayload } from 'jsonwebtoken';
33
import { AppError, errDef } from '../utils/errors';
44
import { IBearerAuthResLocals } from './bearerAuth';
55

src/middleware/validateUserIdUser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NextFunction, Request, Response } from 'express';
2-
import { JwtPayload } from 'jsonwebtoken';
2+
// import { JwtPayload } from 'jsonwebtoken';
33
import { AppError, errDef } from '../utils/errors';
44
import { IBearerAuthResLocals } from './bearerAuth';
55

src/server.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import config from './utils/config';
22
config();
33

44
import cors from 'cors';
5-
import express, { NextFunction, Request, Response } from 'express';
5+
import express from 'express';
66
import helmet from 'helmet';
77
import pinoHttp from 'pino-http';
88
import apiRouter from './api';
99
import errorHandler from './errorHandler';
1010
import { corsOption } from './utils/cors';
1111
import { logger, pinoExpOpt } from './utils/logger';
1212

13-
const { TRUST_PROXY = '', PORT = '3000' } = process.env;
13+
// const { TRUST_PROXY = '' } = process.env;
14+
const { PORT = '3000' } = process.env;
1415
const app = express();
1516

1617
// Tell Express if this app is behind a proxy

src/services/createRole/provider.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import { QueryResult } from 'pg';
21
import { IPermission } from '../../utils/access';
32
import db from '../../utils/db';
4-
import { UK_ERR_CODE } from '../../utils/errors';
53

64
export const SQL_INSERT_ROLE = `INSERT INTO user_role(name)
75
VALUES ($1::VARCHAR(50))

0 commit comments

Comments
 (0)