Skip to content

Commit 9f46882

Browse files
committed
chore: add lint script for example app
1 parent 3aad9cb commit 9f46882

File tree

6 files changed

+18
-13
lines changed

6 files changed

+18
-13
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"javascript.validate.enable": false,
3-
"typescript.tsdk": "node_modules/typescript/lib",
3+
"typescript.tsdk": "./node_modules/typescript/lib",
44
"editor.codeActionsOnSave": {
55
"source.fixAll.eslint": true
66
},

example/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
"ts-node-dev": "^1.0.0-pre.44"
1414
},
1515
"scripts": {
16-
"watch": "ts-node-dev ./src/index.ts --no-notify"
16+
"watch": "ts-node-dev ./src/index.ts --no-notify",
17+
"tscheck": "../node_modules/.bin/tsc --noEmit",
18+
"eslint": "../node_modules/.bin/eslint --ext .ts ./src",
19+
"lint": "yarn eslint && yarn tscheck"
1720
}
1821
}

example/src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//import 'dotenv/config'
22

33
const BULL_REDIS_URI = {
4-
port: process.env.REDIS_PORT || 6379,
4+
port: parseInt(process.env.REDIS_PORT || '6379'),
55
host: process.env.REDIS_HOST || '127.0.0.1',
66
password: process.env.REDIS_PASSWORD || '',
77
};

example/src/queues/fetchMetrics.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,19 @@ const metricsWorker = new Worker(
3535
//https://github.com/taskforcesh/bullmq/issues/69
3636
console.log(new Date().toISOString(), 'Starting name: ' + job.name + ', job: ' + job.id);
3737
return new Promise((resolve) => {
38-
setTimeout(() =>
39-
resolve({
40-
status: 'job completed',
41-
result: new Date().toISOString(),
42-
})
38+
setTimeout(
39+
() =>
40+
resolve({
41+
status: 'job completed',
42+
result: new Date().toISOString(),
43+
}),
44+
0
4345
);
4446
});
4547
},
4648
{
4749
prefix,
48-
connection: metricsQueue.client,
50+
connection: BULL_REDIS_URI,
4951
}
5052
);
5153

example/src/schema/mutation/_helpers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import { PayloadStatusEnum, ErrorCodeEnum } from '../types/enums';
1010
import { PayloadError } from '../../declarations/errors';
1111

1212
export function getQueue(queueName: string, context: any): Queue {
13-
const Queue = context?.Queues?.get(queueName);
14-
if (!Queue) {
13+
const queue = context?.Queues?.get(queueName);
14+
if (!queue) {
1515
throw new PayloadError('Queue not found!', ErrorCodeEnum.QUEUE_NOT_FOUND);
1616
}
17-
return Queue;
17+
return queue;
1818
}
1919

2020
type FieldConfig = Omit<ObjectTypeComposerFieldConfigAsObjectDefinition<any, any>, 'type'> & {

example/src/schema/types/queue/waitingJobs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function createWaitingJobsFC({ JobTC }) {
1313
defaultValue: -1,
1414
},
1515
},
16-
resolve: async (queue: Queue, { status, start, end }) => {
16+
resolve: async (queue: Queue, { start, end }) => {
1717
return await queue.getWaiting(start, end);
1818
},
1919
};

0 commit comments

Comments
 (0)