Skip to content

Commit

Permalink
(fix): fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
belovetech committed Sep 26, 2023
1 parent d67ba8c commit 93840c2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"movie:test": "pnpm --filter movie-service run test",
"test": "npx nx run-many --target=test --all",
"build": "npx nx run-many --target=build --all",
"lint": "npx nx run-many --target=lint --all"
"lint": "npx nx run-many -t lint:fix -p auth-service movie-service ticket-service, payment-service"
},
"devDependencies": {
"nx": "^16.7.4"
Expand Down
1 change: 0 additions & 1 deletion packages/shared-libs/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ module.exports = {
indent: ['error', 2],
semi: ['error', 'always'],
'linebreak-style': ['error', 'unix'],
// quotes: ['error', 'double'],
},
};
9 changes: 4 additions & 5 deletions packages/shared-libs/__tests__/endpoint.logger.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import express, { Application } from 'express';
import express, { Express } from 'express';
import { describe, expect, vi, it } from 'vitest';
import { logger } from '../src/index';
import {
getEndPoints,
concatMethods,
longestLength,
getlongestPath,
EndpointAttributes,
printEndpoints,
} from '../src/print.endpoints';

describe('EndpointLogger', () => {
const app: Application = express();
const app: Express = express();

app.get('/test', (req, res) => {
res.send('test');
Expand Down Expand Up @@ -47,14 +46,14 @@ describe('EndpointLogger', () => {

describe('#concatMethods', () => {
it('should return a 2d array of methods', () => {
const methods = concatMethods(endpoints as EndpointAttributes[]);
const methods = concatMethods(endpoints);
expect(methods).toStrictEqual([['GET', 'POST'], ['POST']]);
});
});

describe('#longestLength', () => {
it('should return the longest length of methods', () => {
const methods = concatMethods(endpoints as EndpointAttributes[]);
const methods = concatMethods(endpoints);
const [longestmethodString, itemNumber] = longestLength(methods);
expect(longestmethodString).toEqual(7);
expect(itemNumber).toEqual(2);
Expand Down
1 change: 0 additions & 1 deletion packages/shared-libs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"test": "npm run docker-rabbitmq && vitest --watch",
"ui:test": "vitest --ui",
"lint": "npm run prettier:check && npm run eslint",
"lint:fix": "npm run eslint:fix && npm run prettier:fix",
"prettier:cli": "prettier \"**/*.ts\" \"**/*.js\"",
"prettier:check": "npm run prettier:cli -- -l",
"prettier:fix": "npm run prettier:cli -- --write",
Expand Down
8 changes: 2 additions & 6 deletions packages/shared-libs/src/authentication.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { sign, verify } from 'jsonwebtoken';

interface ITokenPayload {
customerId: string;
}

export const generateToken = (payload: ITokenPayload, secretKey: string) => {
return sign(payload, secretKey, { expiresIn: '1d' });
export const generateToken = (payload: unknown, secretKey: string) => {
return sign({ payload }, secretKey, { expiresIn: '1d' });
};

export const verifyToken = (token: string, secretKey: string) => {
Expand Down

0 comments on commit 93840c2

Please sign in to comment.