Skip to content

Commit a156d49

Browse files
committed
fix linting
1 parent 954ff0f commit a156d49

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

server/src/router/common.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,9 @@ export function scan(
292292
itemId =
293293
(item as any).id ||
294294
((item as any).get && (item as any).get('id'));
295-
} catch {}
295+
} catch (e) {
296+
// Ignore error when getting item ID
297+
}
296298
console.error(
297299
'Populate failed for item',
298300
itemId ? { id: itemId } : '',
@@ -332,7 +334,9 @@ export function scan(
332334
itemId =
333335
(item as any).id ||
334336
((item as any).get && (item as any).get('id'));
335-
} catch {}
337+
} catch (e) {
338+
// Ignore error when getting item ID
339+
}
336340
console.error(
337341
'Error in scan response: populate failed for item',
338342
itemId ? { id: itemId } : '',

server/src/router/ride.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ router.get('/diagnose', async (_req, res) => {
4343
try {
4444
id =
4545
(item as any).id || ((item as any).get && (item as any).get('id'));
46-
} catch {}
46+
} catch (e) {
47+
// Ignore error when getting item ID
48+
}
4749
try {
4850
const populated = await (item as any).populate();
4951
if (id) goodIds.push(id);
@@ -125,7 +127,7 @@ router.get('/repeating', validateUser('User'), (req, res) => {
125127
query: { rider },
126128
} = req;
127129
const now = moment().format('YYYY-MM-DD');
128-
let condition = new Condition('recurring')
130+
const condition = new Condition('recurring')
129131
.eq(true)
130132
.where('endDate')
131133
.ge(now)
@@ -274,7 +276,9 @@ router.get('/diagnose', async (_req, res) => {
274276
try {
275277
id =
276278
(item as any).id || ((item as any).get && (item as any).get('id'));
277-
} catch {}
279+
} catch (e) {
280+
// Ignore error when getting item ID
281+
}
278282
try {
279283
const populated = await (item as any).populate();
280284
if (id) goodIds.push(id);
@@ -417,7 +421,10 @@ router.put('/:id', validateUser('User'), (req, res) => {
417421
} else if (body.$REMOVE && body.$REMOVE.includes('driver')) {
418422
// If driver is being removed, mark as unscheduled
419423
body.schedulingState = SchedulingState.UNSCHEDULED;
420-
} else if (body.hasOwnProperty('driver') && !body.driver) {
424+
} else if (
425+
Object.prototype.hasOwnProperty.call(body, 'driver') &&
426+
!body.driver
427+
) {
421428
// If driver is explicitly set to null/undefined, mark as unscheduled
422429
body.schedulingState = SchedulingState.UNSCHEDULED;
423430
}

0 commit comments

Comments
 (0)