Skip to content

Commit c460417

Browse files
authored
upgrade @nish1896/eslint-config to 1.0.4 (#7)
1 parent 825eb90 commit c460417

File tree

22 files changed

+50
-51
lines changed

22 files changed

+50
-51
lines changed

apps/express-server/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
22
extends: ['@nish1896']
3-
}
3+
};

apps/express-server/src/app-constants/env_vars.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@
55

66
const env = process.env;
77

8-
export const ENV_VARS = Object.freeze({
9-
port: env.port ?? 5000,
10-
});
8+
export const ENV_VARS = Object.freeze({ port: env.port ?? 5000 });

apps/express-server/src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ app.get('/', (_: Request, response: Response) => {
1515
response.status(200).send('Api is up & running!!!');
1616
});
1717

18-
app.use(`/api/auth`, Routes.authRouter);
18+
app.use('/api/auth', Routes.authRouter);
1919

2020
/* 404 Handler - To be written at last */
2121
app.get('*', (req: Request, response: Response) => {

apps/express-server/src/middleware/guard.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { winstonLogger } from './winston-logger';
44
export function validateAuthHeader(
55
req: Request<object, object, object, object>,
66
res: Response,
7-
next: NextFunction
7+
next: NextFunction,
88
) {
99
/* Check presence of jwt and refresh-token */
10-
let token: string | undefined = req.cookies?.['jwt'];
10+
const token: string | undefined = req.cookies?.jwt;
1111

1212
if (!token) {
1313
const errorMsg = 'Unauthorized request';
@@ -22,7 +22,7 @@ export function validateAuthHeader(
2222
export function authenticateAdmin(
2323
_: Request<object, object, object, object>,
2424
res: Response,
25-
next: NextFunction
25+
next: NextFunction,
2626
) {
2727
if (res.locals?.user?.role === 'Admin') {
2828
next();
@@ -37,7 +37,7 @@ export function checkTokenMismatchInReqParams(
3737
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3838
req: Request<any, object, object, object>,
3939
res: Response,
40-
next: NextFunction
40+
next: NextFunction,
4141
) {
4242
if (res.locals?.user?._id !== req.params.id) {
4343
return res.status(406).send('Token Mismatch').end();

apps/express-server/src/middleware/request-logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { winstonLogger } from './winston-logger';
44
export function requestLogger(
55
request: Request,
66
response: Response,
7-
next: NextFunction
7+
next: NextFunction,
88
) {
99
winstonLogger.info(`${request.method} ${request.url}`);
1010
response.on('finish', () => {

apps/express-server/src/middleware/winston-logger.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ const customLevels = {
1111
warn: 1,
1212
info: 2,
1313
http: 3,
14-
success: 4
14+
success: 4,
1515
},
1616
colors: {
1717
error: 'bold red blackBG',
1818
warn: 'italic yellow',
1919
info: 'blue',
2020
http: 'magenta',
21-
success: 'green'
21+
success: 'green',
2222
},
2323
};
2424

2525
const myFormat = printf(
26-
({ level, message, timestamp }) => `[ ${level} ]:: ${timestamp} - ${message}`
26+
({ level, message, timestamp }) => `[ ${level} ]:: ${timestamp} - ${message}`,
2727
);
2828

2929
/**
@@ -46,7 +46,7 @@ const winstonLogger = createLogger({
4646

4747
/* Aligns in a tabular format */
4848
// format.align(),
49-
myFormat
49+
myFormat,
5050
),
5151
// defaultMeta: { service: 'log-service' },
5252
transports: [
@@ -71,7 +71,7 @@ addColors(customLevels.colors);
7171

7272
if (process.env.NODE_ENV !== 'production') {
7373
winstonLogger.add(
74-
new transports.Console({ format: format.colorize({ all: true }) })
74+
new transports.Console({ format: format.colorize({ all: true }) }),
7575
);
7676
}
7777

apps/express-server/src/routes/auth/controller.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ const authRouter = Router();
66

77
authRouter.get(
88
'/test',
9-
async function printHello(_, res: Response) {
9+
function printHello(_, res: Response) {
1010
return res.status(200).send('Hello World !!').end();
11-
}
11+
},
1212
);
1313

1414
/* Login user */
1515
authRouter.post(
1616
'/login',
17-
async function loginUser(
17+
function loginUser(
1818
req: Request<object, object, AuthTypes.UserLoginBody>,
19-
res: Response
19+
res: Response,
2020
) {
2121
const { email, password } = req.body;
22-
return await authService.loginUser(res, email, password);
23-
}
22+
return authService.loginUser(res, email, password);
23+
},
2424
);
2525

2626
export { authRouter };

apps/express-server/src/routes/auth/service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { Response } from 'express';
22

33
class AuthService {
4-
async loginUser(res: Response, email: string, password: string) {
4+
loginUser(res: Response, email: string, password: string) {
55
try {
6-
res.send({
6+
res.status(200).send({
77
email,
88
password,
9-
});
9+
}).end();
1010
} catch (err) {
1111
res.status(500).send('Internal Server Error');
1212
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export interface UserLoginBody {
22
email: string;
33
password: string;
4-
}
4+
}

apps/frontend/.eslintrc.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
// module.exports = {
2-
// extends: ['@nish1896']
3-
// }
1+
module.exports = {
2+
extends: ['@nish1896'],
3+
rules: {
4+
'@typescript-eslint/no-non-null-assertion': 'off',
5+
}
6+
};

0 commit comments

Comments
 (0)