Skip to content

Commit

Permalink
upgrade @nish1896/eslint-config to 1.0.4 (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
nishkohli96 authored Feb 11, 2024
1 parent 825eb90 commit c460417
Show file tree
Hide file tree
Showing 22 changed files with 50 additions and 51 deletions.
2 changes: 1 addition & 1 deletion apps/express-server/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: ['@nish1896']
}
};
4 changes: 1 addition & 3 deletions apps/express-server/src/app-constants/env_vars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@

const env = process.env;

export const ENV_VARS = Object.freeze({
port: env.port ?? 5000,
});
export const ENV_VARS = Object.freeze({ port: env.port ?? 5000 });
2 changes: 1 addition & 1 deletion apps/express-server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ app.get('/', (_: Request, response: Response) => {
response.status(200).send('Api is up & running!!!');
});

app.use(`/api/auth`, Routes.authRouter);
app.use('/api/auth', Routes.authRouter);

/* 404 Handler - To be written at last */
app.get('*', (req: Request, response: Response) => {
Expand Down
8 changes: 4 additions & 4 deletions apps/express-server/src/middleware/guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { winstonLogger } from './winston-logger';
export function validateAuthHeader(
req: Request<object, object, object, object>,
res: Response,
next: NextFunction
next: NextFunction,
) {
/* Check presence of jwt and refresh-token */
let token: string | undefined = req.cookies?.['jwt'];
const token: string | undefined = req.cookies?.jwt;

if (!token) {
const errorMsg = 'Unauthorized request';
Expand All @@ -22,7 +22,7 @@ export function validateAuthHeader(
export function authenticateAdmin(
_: Request<object, object, object, object>,
res: Response,
next: NextFunction
next: NextFunction,
) {
if (res.locals?.user?.role === 'Admin') {
next();
Expand All @@ -37,7 +37,7 @@ export function checkTokenMismatchInReqParams(
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
req: Request<any, object, object, object>,
res: Response,
next: NextFunction
next: NextFunction,
) {
if (res.locals?.user?._id !== req.params.id) {
return res.status(406).send('Token Mismatch').end();
Expand Down
2 changes: 1 addition & 1 deletion apps/express-server/src/middleware/request-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { winstonLogger } from './winston-logger';
export function requestLogger(
request: Request,
response: Response,
next: NextFunction
next: NextFunction,
) {
winstonLogger.info(`${request.method} ${request.url}`);
response.on('finish', () => {
Expand Down
10 changes: 5 additions & 5 deletions apps/express-server/src/middleware/winston-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ const customLevels = {
warn: 1,
info: 2,
http: 3,
success: 4
success: 4,
},
colors: {
error: 'bold red blackBG',
warn: 'italic yellow',
info: 'blue',
http: 'magenta',
success: 'green'
success: 'green',
},
};

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

/**
Expand All @@ -46,7 +46,7 @@ const winstonLogger = createLogger({

/* Aligns in a tabular format */
// format.align(),
myFormat
myFormat,
),
// defaultMeta: { service: 'log-service' },
transports: [
Expand All @@ -71,7 +71,7 @@ addColors(customLevels.colors);

if (process.env.NODE_ENV !== 'production') {
winstonLogger.add(
new transports.Console({ format: format.colorize({ all: true }) })
new transports.Console({ format: format.colorize({ all: true }) }),
);
}

Expand Down
12 changes: 6 additions & 6 deletions apps/express-server/src/routes/auth/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ const authRouter = Router();

authRouter.get(
'/test',
async function printHello(_, res: Response) {
function printHello(_, res: Response) {
return res.status(200).send('Hello World !!').end();
}
},
);

/* Login user */
authRouter.post(
'/login',
async function loginUser(
function loginUser(
req: Request<object, object, AuthTypes.UserLoginBody>,
res: Response
res: Response,
) {
const { email, password } = req.body;
return await authService.loginUser(res, email, password);
}
return authService.loginUser(res, email, password);
},
);

export { authRouter };
6 changes: 3 additions & 3 deletions apps/express-server/src/routes/auth/service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Response } from 'express';

class AuthService {
async loginUser(res: Response, email: string, password: string) {
loginUser(res: Response, email: string, password: string) {
try {
res.send({
res.status(200).send({
email,
password,
});
}).end();
} catch (err) {
res.status(500).send('Internal Server Error');
}
Expand Down
2 changes: 1 addition & 1 deletion apps/express-server/src/routes/auth/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface UserLoginBody {
email: string;
password: string;
}
}
9 changes: 6 additions & 3 deletions apps/frontend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// module.exports = {
// extends: ['@nish1896']
// }
module.exports = {
extends: ['@nish1896'],
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
}
};
2 changes: 1 addition & 1 deletion apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"web-vitals": "^3.5.2"
},
"devDependencies": {
"@nish1896/eslint-config": "^1.0.3",
"@nish1896/eslint-config": "^1.0.4",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.1",
"@testing-library/user-event": "^14.5.2",
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/react-app-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/// <reference types="react-scripts" />
// / <reference types="react-scripts" />
2 changes: 1 addition & 1 deletion apps/frontend/src/redux-store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export * from './hooks';
export * from './reducers';
export * from './services';
export * from './store';
export * from './types';
export * from './types';
2 changes: 1 addition & 1 deletion apps/frontend/src/redux-store/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { store } from './store';

export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;
export type AppDispatch = typeof store.dispatch;
4 changes: 1 addition & 3 deletions apps/nestjs-server/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ module.exports = {
tsconfigRootDir: __dirname,
sourceType: 'module',
},
extends: [
'@nish1896'
],
extends: ['@nish1896'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
Expand Down
2 changes: 1 addition & 1 deletion apps/nestjs-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@nestjs/cli": "^10.3.2",
"@nestjs/schematics": "^10.1.1",
"@nestjs/testing": "^10.3.2",
"@nish1896/eslint-config": "^1.0.3",
"@nish1896/eslint-config": "^1.0.4",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.17",
Expand Down
2 changes: 1 addition & 1 deletion apps/nestjs-server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function bootstrap() {
new FastifyAdapter({
ignoreTrailingSlash: true,
caseSensitive: false,
})
}),
);
await app.listen(4000);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/nestjs-server/src/routes/home/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import { HomeService } from './service';
controllers: [HomeController],
providers: [HomeService],
})
export class HomeModule {}
export class HomeModule {}
2 changes: 1 addition & 1 deletion apps/next-client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
extends: [
'next/core-web-vitals',
// '@nish1896'
'@nish1896'
],
}
2 changes: 1 addition & 1 deletion apps/next-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@nish1896/eslint-config": "^1.0.3",
"@nish1896/eslint-config": "^1.0.4",
"@types/node": "^20.11.17",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
Expand Down
2 changes: 1 addition & 1 deletion packages/core-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"typescript": "^5.3.3"
},
"devDependencies": {
"@nish1896/eslint-config": "^1.0.3",
"@nish1896/eslint-config": "^1.0.4",
"eslint": "^8.56.0"
}
}
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2315,14 +2315,14 @@
dependencies:
eslint-scope "5.1.1"

"@nish1896/eslint-config@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@nish1896/eslint-config/-/eslint-config-1.0.3.tgz#cdaa3e7772ec276fb66a533d41ab7acfdf869de0"
integrity sha512-9L1Ul4S4hW4FpN8WwmrtLT92PY4ph+dTa8kM2fLU6H02j3/qosPQw+hVlBOI2ktlRe5iTxgS/3AXTpCQLKarVQ==
"@nish1896/eslint-config@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@nish1896/eslint-config/-/eslint-config-1.0.4.tgz#ab9669ea5cbbd762b95bf17cb3163762c6e6e997"
integrity sha512-QmWgufEAoS4bZEAPgYzq7yA2DHCIG9A5TcYLGITsuNVuhmXuzzeWJA6iQIxm+9OotVrL1rvTHg1gBLzg4Mi5sw==
dependencies:
"@stylistic/eslint-plugin" "^1.5.4"
"@typescript-eslint/eslint-plugin" "^6.19.0"
"@typescript-eslint/parser" "^6.19.0"
"@stylistic/eslint-plugin" "^1.6.1"
"@typescript-eslint/eslint-plugin" "^6.21.0"
"@typescript-eslint/parser" "^6.21.0"
eslint-plugin-jsx-a11y "^6.8.0"
eslint-plugin-react "^7.33.2"
eslint-plugin-react-hooks "^4.6.0"
Expand Down Expand Up @@ -2511,7 +2511,7 @@
"@stylistic/eslint-plugin-js" "1.6.1"
"@typescript-eslint/utils" "^6.20.0"

"@stylistic/eslint-plugin@^1.5.4":
"@stylistic/eslint-plugin@^1.6.1":
version "1.6.1"
resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin/-/eslint-plugin-1.6.1.tgz#011e408ad9a1dddfe9517ace9dd3b6ce9ef4b17b"
integrity sha512-De7Sw86OtIf7SsMgjLCf4bTeI3085Plyh4l0Rg1V42BTFo/Q6Pz7Cbu31rEk/UHFiEna/YO8Hxj80jFP3ObrQw==
Expand Down Expand Up @@ -3154,7 +3154,7 @@
semver "^7.3.7"
tsutils "^3.21.0"

"@typescript-eslint/eslint-plugin@^6.19.0":
"@typescript-eslint/eslint-plugin@^6.21.0":
version "6.21.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz#30830c1ca81fd5f3c2714e524c4303e0194f9cd3"
integrity sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==
Expand All @@ -3178,7 +3178,7 @@
dependencies:
"@typescript-eslint/utils" "5.62.0"

"@typescript-eslint/parser@^5.4.2 || ^6.0.0", "@typescript-eslint/parser@^6.19.0":
"@typescript-eslint/parser@^5.4.2 || ^6.0.0", "@typescript-eslint/parser@^6.21.0":
version "6.21.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.21.0.tgz#af8fcf66feee2edc86bc5d1cf45e33b0630bf35b"
integrity sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==
Expand Down

0 comments on commit c460417

Please sign in to comment.