Skip to content

Commit a81c9da

Browse files
committed
linting
1 parent 6e91082 commit a81c9da

File tree

8 files changed

+95
-98
lines changed

8 files changed

+95
-98
lines changed

cdk/typescript/jest.config.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
'use strict';
12
module.exports = {
2-
roots: ['<rootDir>/test'],
3-
testMatch: ['**/*.test.ts'],
4-
transform: {
5-
'^.+\\.tsx?$': 'ts-jest'
6-
}
3+
roots: ['<rootDir>/test'],
4+
testMatch: ['**/*.test.ts'],
5+
transform: {
6+
'^.+\\.tsx?$': 'ts-jest',
7+
},
78
};

lambda/analyzer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports.handler = async(event, context) => {
2727

2828
const result = findOptimalConfiguration(event);
2929

30-
if (!!event.includeOutputResults) {
30+
if (event.includeOutputResults) {
3131
// add stats to final result
3232
result.stats = event.stats.map(stat => ({
3333
value: stat.value,

lambda/cleaner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const { ResourceNotFoundException } = require("@aws-sdk/client-lambda");
3+
const { ResourceNotFoundException } = require('@aws-sdk/client-lambda');
44
const utils = require('./utils');
55

66
/**

lambda/utils.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

3-
const { CreateAliasCommand, DeleteAliasCommand, DeleteFunctionCommand, GetAliasCommand, GetFunctionConfigurationCommand, InvokeCommand, LambdaClient, PublishVersionCommand, UpdateAliasCommand, UpdateFunctionConfigurationCommand, waitUntilFunctionActive, waitUntilFunctionUpdated, ResourceNotFoundException } = require("@aws-sdk/client-lambda");
4-
const { GetObjectCommand, S3Client } = require("@aws-sdk/client-s3");
3+
const { CreateAliasCommand, DeleteAliasCommand, DeleteFunctionCommand, GetAliasCommand, GetFunctionConfigurationCommand, InvokeCommand, LambdaClient, PublishVersionCommand, UpdateAliasCommand, UpdateFunctionConfigurationCommand, waitUntilFunctionActive, waitUntilFunctionUpdated, ResourceNotFoundException } = require('@aws-sdk/client-lambda');
4+
const { GetObjectCommand, S3Client } = require('@aws-sdk/client-s3');
55
const url = require('url');
66

77

@@ -56,7 +56,7 @@ module.exports.verifyAliasExistance = async(lambdaARN, alias) => {
5656
await utils.getLambdaAlias(lambdaARN, alias);
5757
return true;
5858
} catch (error) {
59-
console.log("Error during verifyAlias (probably OK!)")
59+
console.log('Error during verifyAlias (probably OK!)');
6060
if (error instanceof ResourceNotFoundException) {
6161
// OK, the alias isn't supposed to exist
6262
console.log('OK, even if missing alias ');
@@ -245,7 +245,7 @@ module.exports.deleteLambdaAlias = (lambdaARN, alias) => {
245245
Name: alias,
246246
};
247247
const lambda = utils.lambdaClientFromARN(lambdaARN);
248-
return lambda.send( new DeleteAliasCommand(params));
248+
return lambda.send(new DeleteAliasCommand(params));
249249
};
250250

251251
/**
@@ -366,13 +366,12 @@ module.exports._fetchS3Object = async(bucket, key) => {
366366
Bucket: bucket,
367367
Key: key,
368368
};
369-
var response = undefined;
370-
response = await s3Client.send(new GetObjectCommand(input));
369+
var response = await s3Client.send(new GetObjectCommand(input));
371370
return await response.Body.transformToString('utf-8');
372371
} catch (err) {
373-
var statusCode = err.statusCode
372+
var statusCode = err.statusCode;
374373
if (err.$response && err.$response.statusCode) {
375-
statusCode = err.$response.statusCode
374+
statusCode = err.$response.statusCode;
376375
}
377376
if (statusCode === 403) {
378377
throw new Error(
@@ -566,12 +565,12 @@ module.exports.extractDurationFromText = (log) => {
566565
module.exports.extractDurationFromJSON = (log) => {
567566
// extract each line and parse it to JSON object
568567
const lines = log.split('\n').filter((line) => line.startsWith('{')).map((line) => {
569-
try {
570-
return JSON.parse(line);
571-
} catch (e) {
568+
try {
569+
return JSON.parse(line);
570+
} catch (e) {
572571
console.error(`Detected invalid JSON line: ${line}`);
573-
return '';
574-
}
572+
return '';
573+
}
575574
});
576575
// find the log corresponding to the invocation report
577576
const durationLine = lines.find((line) => line.type === 'platform.report');
@@ -610,8 +609,8 @@ module.exports.lambdaClientFromARN = (lambdaARN) => {
610609
const region = this.regionFromARN(lambdaARN);
611610
return new LambdaClient({
612611
region,
613-
requestTimeout: 15 * 60 * 1000
614-
})
612+
requestTimeout: 15 * 60 * 1000,
613+
});
615614
};
616615

617616
/**

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
],
2222
"licence": "Apache",
2323
"scripts": {
24-
"deploy": "bash deploy.sh",
25-
"execute": "bash execute.sh",
2624
"lint": "eslint --ignore-path .gitignore .",
2725
"test": "mocha",
2826
"coverage": "c8 --reporter=lcov --reporter=cobertura --reporter=text-summary mocha"

test/unit/test-lambda.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const sinon = require('sinon');
44
const expect = require('expect.js');
55

66
var awsV3Mock = require('aws-sdk-client-mock');
7-
const { CreateAliasCommand, DeleteAliasCommand, DeleteFunctionCommand, GetAliasCommand, InvokeCommand, LambdaClient, PublishVersionCommand, UpdateAliasCommand, UpdateFunctionConfigurationCommand, ResourceNotFoundException } = require("@aws-sdk/client-lambda");
7+
const { CreateAliasCommand, DeleteAliasCommand, DeleteFunctionCommand, GetAliasCommand, InvokeCommand, LambdaClient, PublishVersionCommand, UpdateAliasCommand, UpdateFunctionConfigurationCommand, ResourceNotFoundException } = require('@aws-sdk/client-lambda');
88

99
const utils = require('../../lambda/utils');
1010

@@ -1687,7 +1687,7 @@ describe('Lambda Functions', async() => {
16871687
expect(result.stats).to.eql(event.stats.map(stat => ({
16881688
value: stat.value,
16891689
averagePrice: stat.averagePrice,
1690-
averageDuration: stat.averageDuration
1690+
averageDuration: stat.averageDuration,
16911691
})));
16921692

16931693
expect(result.stats[0]).to.not.have.property('totalCost');

0 commit comments

Comments
 (0)