Skip to content

Commit

Permalink
Merge pull request #831 from balena-io/linting-fixes
Browse files Browse the repository at this point in the history
Linting fixes
  • Loading branch information
Page- authored Oct 24, 2024
2 parents 8a165e3 + 709e32b commit 7ed25f6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/database-layer/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ const createTransaction = (createFunc: CreateTransactionFn): TransactionFn => {
let maybePg: typeof Pg | undefined;
try {
maybePg = require('pg');
} catch (e) {
} catch {
// Ignore errors
}
interface EngineParams {
Expand Down Expand Up @@ -729,7 +729,7 @@ if (maybePg != null) {
let maybeMysql: typeof Mysql | undefined;
try {
maybeMysql = require('mysql');
} catch (e) {
} catch {
// Ignore errors
}
interface EngineParams {
Expand Down Expand Up @@ -884,7 +884,7 @@ if (typeof window !== 'undefined' && window.openDatabase != null) {
const getInsertId = (result: WebSqlResult) => {
try {
return result.insertId;
} catch (e) {
} catch {
// Ignore the potential DOM exception.
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/sbvr-api/cached-compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let cache: null | {
let fs: undefined | typeof Fs;
try {
fs = require('fs');
} catch (e) {
} catch {
// Ignore error
}

Expand Down Expand Up @@ -43,7 +43,7 @@ export const cachedCompile = <T>(
if (fs != null) {
try {
cache = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));
} catch (e) {
} catch {
// Ignore error
}
}
Expand Down
10 changes: 2 additions & 8 deletions src/sbvr-api/uri-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,8 @@ const memoizedOdata2AbstractSQL = (() => {
string[],
number,
],
) => {
return (
JSON.stringify(odataQuery) +
method +
bodyKeys +
existingBindVarsLength
);
},
) =>
`${JSON.stringify(odataQuery)}${method}${bodyKeys}${existingBindVarsLength}`,
weak: true,
},
);
Expand Down
2 changes: 1 addition & 1 deletion src/webresource-handler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ const getCreateWebResourceHooks = (
const webResourceFields = getWebResourceFields(hookArgs.request);
throwIfWebresourceNotInMultipart(webResourceFields, hookArgs);
},
'POSTRUN-ERROR': async ({ tx, request }) => {
'POSTRUN-ERROR': ({ tx, request }) => {
tx.on('rollback', () => {
void deleteRollbackPendingFields(request, webResourceHandler);
});
Expand Down
13 changes: 6 additions & 7 deletions test/08-tasks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('08 task tests', function () {
.expect(201);
});

after(async () => {
after(() => {
testDeInit(pineServer);
});

Expand Down Expand Up @@ -349,7 +349,7 @@ describe('08 task tests', function () {
const cron = '0 0 10 1 1 *';

// Test both succeeded and failure cases
['succeeded', 'failed'].forEach(async (status) => {
for (const status of ['succeeded', 'failed']) {
const handler = status === 'succeeded' ? 'create_device' : 'will_fail';
const name = randomUUID();
await createTask(pineTest, apikey, {
Expand All @@ -358,24 +358,23 @@ describe('08 task tests', function () {
is_scheduled_to_execute_on__time: new Date(Date.now() + 3000),
is_executed_with__parameter_set: {
name,
type: randomUUID(),
},
});

const nextExecutionDate = cronParser
.parseExpression(cron)
.next()
.toDate();
.toISOString();
await waitFor(async () => {
const { body: tasks } = await pineTest
.get({
resource: 'task',
options: {
$select: ['status', 'is_scheduled_to_execute_on__time'],
$filter: {
is_executed_by__handler: handler,
is_scheduled_with__cron_expression: cron,
is_executed_with__parameter_set: {
name,
},
},
},
})
Expand All @@ -389,7 +388,7 @@ describe('08 task tests', function () {
queuedTask.is_scheduled_to_execute_on__time === nextExecutionDate
);
});
});
}
});

it('should not allow tasks with invalid handler params', async () => {
Expand Down

0 comments on commit 7ed25f6

Please sign in to comment.