From 31ca0a4b601ff90f1c20b7be60ec653fababc6aa Mon Sep 17 00:00:00 2001 From: Ryan Block Date: Mon, 29 Apr 2024 13:31:08 -0700 Subject: [PATCH] Lint --- scripts/deploy.js | 4 +- scripts/package.js | 2 +- scripts/print.js | 4 +- src/visitors/events/index.js | 8 +-- src/visitors/globals/index.js | 58 ++++++++--------- src/visitors/globals/ssm.js | 62 +++++++++---------- src/visitors/http/get-api-properties.js | 4 +- src/visitors/http/index.js | 12 ++-- src/visitors/http/proxy.js | 6 +- src/visitors/queues/index.js | 8 +-- src/visitors/scheduled/index.js | 12 ++-- src/visitors/static/add-static-proxy.js | 8 +-- src/visitors/static/index.js | 30 ++++----- src/visitors/tables-streams/index.js | 6 +- .../tables/get-attribute-definitions.js | 6 +- src/visitors/tables/get-key-schema.js | 8 +-- src/visitors/tables/index.js | 6 +- src/visitors/utils/create-lambda.js | 8 +-- src/visitors/utils/get-lambda-env.js | 4 +- src/visitors/ws/index.js | 48 +++++++------- test/integration/integration-test.js | 4 +- .../mock/src/http/get-api/index.js | 2 +- .../mock/src/http/get-foo/index.js | 2 +- test/unit/config-test.js | 8 +-- .../tables-indexes/get-gsi-name-test.js | 2 +- 25 files changed, 161 insertions(+), 161 deletions(-) diff --git a/scripts/deploy.js b/scripts/deploy.js index d3e6d38..d0d2ae7 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -137,7 +137,7 @@ module.exports = function deploy (params = {}, callback) { '--template-file', `${appname}-cfn.yaml`, '--stack-name', name, '--s3-bucket', bucket, - '--capabilities', 'CAPABILITY_AUTO_EXPAND', 'CAPABILITY_IAM' + '--capabilities', 'CAPABILITY_AUTO_EXPAND', 'CAPABILITY_IAM', ], { log, verbose }, callback) }, @@ -152,7 +152,7 @@ module.exports = function deploy (params = {}, callback) { else { callback() } - } + }, ], callback) return promise diff --git a/scripts/package.js b/scripts/package.js index a8be521..ff4dd11 100644 --- a/scripts/package.js +++ b/scripts/package.js @@ -8,6 +8,6 @@ module.exports = function samPackage ({ filename, bucket, log, verbose }, callba '--output-template-file', filename.replace('json', 'yaml'), '--s3-bucket', - bucket + bucket, ], { log, verbose }, callback) } diff --git a/scripts/print.js b/scripts/print.js index 8dba05f..0c92ecc 100644 --- a/scripts/print.js +++ b/scripts/print.js @@ -37,8 +37,8 @@ module.exports = function pretty ({ log, verbose }) { if (!log) return let check = chalk.green('✓') let msg = chalk.grey('Deployed') - let time = chalk.green.bold((Date.now() - ts) / 1000 + ' seconds') + let time = chalk.green.bold(((Date.now() - ts) / 1000) + ' seconds') console.log(check, msg, time) - } + }, } } diff --git a/src/visitors/events/index.js b/src/visitors/events/index.js index cb145ff..f110bf7 100644 --- a/src/visitors/events/index.js +++ b/src/visitors/events/index.js @@ -25,8 +25,8 @@ module.exports = function visitEvents (inventory, template) { template.Resources[eventLambda].Properties.Events[eventEvent] = { Type: 'SNS', Properties: { - Topic: { Ref: eventTopic } - } + Topic: { Ref: eventTopic }, + }, } // Create the SNS topic @@ -34,8 +34,8 @@ module.exports = function visitEvents (inventory, template) { Type: 'AWS::SNS::Topic', Properties: { DisplayName: name, - Subscription: [] - } + Subscription: [], + }, } template.Outputs[eventTopic] = { diff --git a/src/visitors/globals/index.js b/src/visitors/globals/index.js index 3db125d..adab874 100644 --- a/src/visitors/globals/index.js +++ b/src/visitors/globals/index.js @@ -19,13 +19,13 @@ module.exports = function visitGlobals (inventory, template) { Statement: [ { Effect: 'Allow', Principal: { - Service: 'lambda.amazonaws.com' + Service: 'lambda.amazonaws.com', }, - Action: 'sts:AssumeRole' - } ] + Action: 'sts:AssumeRole', + } ], }, - Policies: [] - } + Policies: [], + }, } // Enables logs and capability reflection @@ -38,11 +38,11 @@ module.exports = function visitGlobals (inventory, template) { 'logs:CreateLogGroup', 'logs:CreateLogStream', 'logs:PutLogEvents', - 'logs:DescribeLogStreams' + 'logs:DescribeLogStreams', ], - Resource: 'arn:aws:logs:*:*:*' - } ] - } + Resource: 'arn:aws:logs:*:*:*', + } ], + }, }) // allow lambdas read/write on the static bucket @@ -66,17 +66,17 @@ module.exports = function visitGlobals (inventory, template) { Resource: [ { 'Fn::Sub': [ 'arn:aws:s3:::${bukkit}', - { bukkit } - ] + { bukkit }, + ], }, { 'Fn::Sub': [ 'arn:aws:s3:::${bukkit}/*', - { bukkit } - ] - } ] - } ] - } + { bukkit }, + ], + } ], + } ], + }, }) } @@ -98,8 +98,8 @@ module.exports = function visitGlobals (inventory, template) { 'Fn::Sub': 'arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/*', }, }, - ] - } + ], + }, }) function getTableArns (tables) { return tables.map(table => { @@ -107,14 +107,14 @@ module.exports = function visitGlobals (inventory, template) { return [ { 'Fn::Sub': [ 'arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${tablename}', - { tablename: { Ref: name } } - ] + { tablename: { Ref: name } }, + ], }, { 'Fn::Sub': [ 'arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${tablename}/*', - { tablename: { Ref: name } } - ] + { tablename: { Ref: name } }, + ], } ] }).reduce((a, b) => a.concat(b), []) } @@ -131,15 +131,15 @@ module.exports = function visitGlobals (inventory, template) { 'sns:Publish', ], Resource: getTopicArn(), - } ] - } + } ], + }, }) function getTopicArn () { return { 'Fn::Sub': [ 'arn:aws:sns:${AWS::Region}:${AWS::AccountId}:${AWS::StackName}*', - {} - ] + {}, + ], } } } @@ -158,9 +158,9 @@ module.exports = function visitGlobals (inventory, template) { 'sqs:DeleteMessage', 'sqs:GetQueueAttributes', ], - Resource: '*' - } ] - } + Resource: '*', + } ], + }, }) } diff --git a/src/visitors/globals/ssm.js b/src/visitors/globals/ssm.js index 83fb797..3ae036f 100644 --- a/src/visitors/globals/ssm.js +++ b/src/visitors/globals/ssm.js @@ -17,11 +17,11 @@ module.exports = function ssm ({ inv }, template) { Name: { 'Fn::Sub': [ '/${AWS::StackName}/tables/${tablename}', - { tablename: name } - ] + { tablename: name }, + ], }, - Value: { Ref: TableName } - } + Value: { Ref: TableName }, + }, } }) } @@ -38,11 +38,11 @@ module.exports = function ssm ({ inv }, template) { Name: { 'Fn::Sub': [ '/${AWS::StackName}/events/${event}', - { event: name } - ] + { event: name }, + ], }, - Value: { Ref: Event } - } + Value: { Ref: Event }, + }, } }) } @@ -59,11 +59,11 @@ module.exports = function ssm ({ inv }, template) { Name: { 'Fn::Sub': [ '/${AWS::StackName}/queues/${queue}', - { queue: name } - ] + { queue: name }, + ], }, - Value: { Ref: Queue } - } + Value: { Ref: Queue }, + }, } }) } @@ -82,11 +82,11 @@ module.exports = function ssm ({ inv }, template) { Name: { 'Fn::Sub': [ '/${AWS::StackName}/static/${key}', - { key: 'bucket' } - ] + { key: 'bucket' }, + ], }, - Value - } + Value, + }, } let fingerprint = inv.static.fingerprint ? true : false @@ -97,11 +97,11 @@ module.exports = function ssm ({ inv }, template) { Name: { 'Fn::Sub': [ '/${AWS::StackName}/static/${key}', - { key: 'fingerprint' } - ] + { key: 'fingerprint' }, + ], }, - Value: `${fingerprint}` - } + Value: `${fingerprint}`, + }, } } @@ -122,9 +122,9 @@ module.exports = function ssm ({ inv }, template) { Resource: { 'Fn::Sub': [ 'arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${AWS::StackName}', - {} - ] - } + {}, + ], + }, }, { Effect: 'Allow', @@ -135,9 +135,9 @@ module.exports = function ssm ({ inv }, template) { Resource: { 'Fn::Sub': [ 'arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${AWS::StackName}/*', - {} - ] - } + {}, + ], + }, }, { Effect: 'Allow', @@ -148,14 +148,14 @@ module.exports = function ssm ({ inv }, template) { Resource: { 'Fn::Sub': [ 'arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${AWS::StackName}/*/*', - {} - ] - } + {}, + ], + }, }, - ] + ], }, Roles: [ { Ref: 'Role' } ], - } + }, } } diff --git a/src/visitors/http/get-api-properties.js b/src/visitors/http/get-api-properties.js index e1520f8..d997754 100644 --- a/src/visitors/http/get-api-properties.js +++ b/src/visitors/http/get-api-properties.js @@ -13,7 +13,7 @@ module.exports = function getHttpApiProperties (inventory) { openapi: '3.0.1', info: { title: { Ref: 'AWS::StackName' } }, paths, - } + }, } return Properties } @@ -40,7 +40,7 @@ function getPaths (routes, payloadFormatVersion) { // cacheKeyParameters: [ // 'method.request.path.proxy' // ] - } + }, } } }) diff --git a/src/visitors/http/index.js b/src/visitors/http/index.js index 446c23f..18dfc61 100644 --- a/src/visitors/http/index.js +++ b/src/visitors/http/index.js @@ -45,8 +45,8 @@ module.exports = function visitHttp (inventory, template) { Properties: { Path: path, Method: method.toUpperCase(), - ApiId: { Ref: 'HTTP' } - } + ApiId: { Ref: 'HTTP' }, + }, } }) @@ -57,14 +57,14 @@ module.exports = function visitHttp (inventory, template) { 'Fn::Sub': [ // Always default to staging; mutate to production via macro where necessary 'https://${ApiId}.execute-api.${AWS::Region}.amazonaws.com', - { ApiId: { Ref: 'HTTP' } } - ] - } + { ApiId: { Ref: 'HTTP' } }, + ], + }, } template.Outputs.ApiId = { Description: 'API ID (ApiId)', - Value: { Ref: 'HTTP' } + Value: { Ref: 'HTTP' }, } // Backfill @static diff --git a/src/visitors/http/proxy.js b/src/visitors/http/proxy.js index 317a609..14fb6ad 100644 --- a/src/visitors/http/proxy.js +++ b/src/visitors/http/proxy.js @@ -11,9 +11,9 @@ module.exports = function proxy ({ inv }, template) { httpMethod: 'ANY', uri: inv.proxy[deployStage], connectionType: 'INTERNET', - timeoutInMillis: 30000 - } - } + timeoutInMillis: 30000, + }, + }, } return template diff --git a/src/visitors/queues/index.js b/src/visitors/queues/index.js index caf6196..8a07108 100644 --- a/src/visitors/queues/index.js +++ b/src/visitors/queues/index.js @@ -28,16 +28,16 @@ module.exports = function visitQueues (inventory, template) { template.Resources[queueLambda].Properties.Events[queueEvent] = { Type: 'SQS', Properties: { - Queue: { 'Fn::GetAtt': [ queueQueue, 'Arn' ] } - } + Queue: { 'Fn::GetAtt': [ queueQueue, 'Arn' ] }, + }, } // Create the sqs queue template.Resources[queueQueue] = { Type: 'AWS::SQS::Queue', Properties: { - VisibilityTimeout: timeout - } + VisibilityTimeout: timeout, + }, } // Only add fifo when true; false will cause cfn to fail =/ diff --git a/src/visitors/scheduled/index.js b/src/visitors/scheduled/index.js index 8aa3939..4385912 100644 --- a/src/visitors/scheduled/index.js +++ b/src/visitors/scheduled/index.js @@ -34,10 +34,10 @@ module.exports = function visitScheduled (inventory, template) { Targets: [ { Arn: { 'Fn::GetAtt': [ scheduleLambda, 'Arn' ] }, - Id: scheduleLambda - } - ] - } + Id: scheduleLambda, + }, + ], + }, } // Wire the permission @@ -47,8 +47,8 @@ module.exports = function visitScheduled (inventory, template) { Action: 'lambda:InvokeFunction', FunctionName: { Ref: scheduleLambda }, Principal: 'events.amazonaws.com', - SourceArn: { 'Fn::GetAtt': [ scheduleEvent, 'Arn' ] } - } + SourceArn: { 'Fn::GetAtt': [ scheduleEvent, 'Arn' ] }, + }, } }) diff --git a/src/visitors/static/add-static-proxy.js b/src/visitors/static/add-static-proxy.js index 1dc9dba..f97430b 100644 --- a/src/visitors/static/add-static-proxy.js +++ b/src/visitors/static/add-static-proxy.js @@ -15,8 +15,8 @@ module.exports = function addStatic (inventory, template) { uri: { 'Fn::Sub': [ 'https://${bukkit}.s3.${AWS::Region}.amazonaws.com/{proxy}', - { bukkit } - ] + { bukkit }, + ], }, connectionType: 'INTERNET', timeoutInMillis: 30000, @@ -29,8 +29,8 @@ module.exports = function addStatic (inventory, template) { // cacheKeyParameters: [ // 'method.request.path.proxy' // ] - } - } + }, + }, } return template } diff --git a/src/visitors/static/index.js b/src/visitors/static/index.js index f314a0d..d28da7f 100644 --- a/src/visitors/static/index.js +++ b/src/visitors/static/index.js @@ -41,13 +41,13 @@ module.exports = function visitStatic (inventory, template) { OwnershipControls: { Rules: [ { - ObjectOwnership: 'BucketOwnerEnforced' - } - ] + ObjectOwnership: 'BucketOwnerEnforced', + }, + ], }, WebsiteConfiguration: { IndexDocument: 'index.html', - ErrorDocument: '404.html' + ErrorDocument: '404.html', }, PublicAccessBlockConfiguration: { BlockPublicAcls: false, @@ -55,7 +55,7 @@ module.exports = function visitStatic (inventory, template) { IgnorePublicAcls: false, RestrictPublicBuckets: false, }, - } + }, } } @@ -65,9 +65,9 @@ module.exports = function visitStatic (inventory, template) { Value: { 'Fn::Sub': [ getBucketUrlForRegion(inv.aws.region), - { bukkit } - ] - } + { bukkit }, + ], + }, } // Allow public read access to all objects in the static bucket @@ -85,14 +85,14 @@ module.exports = function visitStatic (inventory, template) { Resource: [ { 'Fn::Sub': [ 'arn:aws:s3:::${bukkit}/*', - { bukkit } - ] + { bukkit }, + ], } ], - Sid: 'PublicReadGetObject' - } - ] - } - } + Sid: 'PublicReadGetObject', + }, + ], + }, + }, } // if an api is defined then add _static proxy and attempt to serialize ./public diff --git a/src/visitors/tables-streams/index.js b/src/visitors/tables-streams/index.js index 562c79b..bafde0e 100644 --- a/src/visitors/tables-streams/index.js +++ b/src/visitors/tables-streams/index.js @@ -28,13 +28,13 @@ module.exports = function visitTablesStreams (inventory, template) { BatchSize: 10, EventSourceArn: { 'Fn::GetAtt': [ tableTable, 'StreamArn' ] }, FunctionName: { 'Fn::GetAtt': [ streamLambda, 'Arn' ] }, - StartingPosition: 'TRIM_HORIZON' - } + StartingPosition: 'TRIM_HORIZON', + }, } // Create the stream template.Resources[tableTable].Properties.StreamSpecification = { - StreamViewType: 'NEW_AND_OLD_IMAGES' + StreamViewType: 'NEW_AND_OLD_IMAGES', } }) return template diff --git a/src/visitors/tables/get-attribute-definitions.js b/src/visitors/tables/get-attribute-definitions.js index 1b15b26..f9c9f1c 100644 --- a/src/visitors/tables/get-attribute-definitions.js +++ b/src/visitors/tables/get-attribute-definitions.js @@ -5,14 +5,14 @@ module.exports = function getAttributeDefinitions (table) { // Always handle partition key defs.push({ AttributeName: partitionKey, - AttributeType: convert(partitionKeyType) + AttributeType: convert(partitionKeyType), }) // Handle sort key if necessary if (sortKey) { defs.push({ AttributeName: sortKey, - AttributeType: convert(sortKeyType) + AttributeType: convert(sortKeyType), }) } @@ -22,6 +22,6 @@ module.exports = function getAttributeDefinitions (table) { function convert (v) { return ({ 'String': 'S', - 'Number': 'N' + 'Number': 'N', })[v] } diff --git a/src/visitors/tables/get-key-schema.js b/src/visitors/tables/get-key-schema.js index 571c2ff..1ee2bed 100644 --- a/src/visitors/tables/get-key-schema.js +++ b/src/visitors/tables/get-key-schema.js @@ -4,7 +4,7 @@ let hashkeys = [ 'HashString', 'HashNumber', 'PartitionString', - 'PartitionNumber' + 'PartitionNumber', ] let rangekeys = [ 'String', @@ -12,7 +12,7 @@ let rangekeys = [ 'RangeString', 'RangeNumber', 'SortString', - 'SortNumber' + 'SortNumber', ] function validate (k, keys) { if (!keys.includes(k)) throw Error(`Unknown key type: ${k}`) @@ -25,7 +25,7 @@ module.exports = function getKeySchema (table) { validate(partitionKeyType, hashkeys) let schema = [ { AttributeName: partitionKey, - KeyType: 'HASH' + KeyType: 'HASH', } ] // Handle sort key if necessary @@ -33,7 +33,7 @@ module.exports = function getKeySchema (table) { validate(sortKeyType, rangekeys) schema.push({ AttributeName: sortKey, - KeyType: 'RANGE' + KeyType: 'RANGE', }) } diff --git a/src/visitors/tables/index.js b/src/visitors/tables/index.js index 1d3101f..adf7759 100644 --- a/src/visitors/tables/index.js +++ b/src/visitors/tables/index.js @@ -26,7 +26,7 @@ module.exports = function visitTables (inventory, template) { KeySchema, AttributeDefinitions, BillingMode: 'PAY_PER_REQUEST', - } + }, } if (encrypt) { @@ -40,14 +40,14 @@ module.exports = function visitTables (inventory, template) { if (pitr || table.PointInTimeRecovery) { template.Resources[tableTable].Properties.PointInTimeRecoverySpecification = { - PointInTimeRecoveryEnabled: true + PointInTimeRecoveryEnabled: true, } } if (ttl) { template.Resources[tableTable].Properties.TimeToLiveSpecification = { AttributeName: ttl, - Enabled: true + Enabled: true, } } }) diff --git a/src/visitors/utils/create-lambda.js b/src/visitors/utils/create-lambda.js index 94c2819..afb4bc4 100644 --- a/src/visitors/utils/create-lambda.js +++ b/src/visitors/utils/create-lambda.js @@ -28,10 +28,10 @@ module.exports = function createLambda (params) { Role: { 'Fn::Sub': [ 'arn:aws:iam::${AWS::AccountId}:role/${roleName}', - { roleName: { Ref: 'Role' } } - ] + { roleName: { Ref: 'Role' } }, + ], }, - Events: {} + Events: {}, }, ArcMetadata: { pragma: pragma || 'custom', @@ -51,7 +51,7 @@ module.exports = function createLambda (params) { if (provisionedConcurrency) { item.Properties.ProvisionedConcurrencyConfig = { - ProvisionedConcurrentExecutions: provisionedConcurrency + ProvisionedConcurrentExecutions: provisionedConcurrency, } item.Properties.AutoPublishAlias = 'live' } diff --git a/src/visitors/utils/get-lambda-env.js b/src/visitors/utils/get-lambda-env.js index 61cac08..9e19ad7 100644 --- a/src/visitors/utils/get-lambda-env.js +++ b/src/visitors/utils/get-lambda-env.js @@ -26,8 +26,8 @@ module.exports = function getEnv (params) { env.ARC_WSS_URL = { 'Fn::Sub': [ 'wss://${WS}.execute-api.${AWS::Region}.amazonaws.com/' + deployStage, - {} - ] + {}, + ], } } diff --git a/src/visitors/ws/index.js b/src/visitors/ws/index.js index ad06a92..291f9b8 100644 --- a/src/visitors/ws/index.js +++ b/src/visitors/ws/index.js @@ -16,8 +16,8 @@ module.exports = function visitWebSockets (inventory, template) { Properties: { Name, ProtocolType: 'WEBSOCKET', - RouteSelectionExpression: '$request.body.action' - } + RouteSelectionExpression: '$request.body.action', + }, } template.Resources.WebsocketDeployment = { @@ -25,11 +25,11 @@ module.exports = function visitWebSockets (inventory, template) { DependsOn: [ 'ConnectWSRoute', 'DefaultWSRoute', - 'DisconnectWSRoute' + 'DisconnectWSRoute', ], Properties: { ApiId: { Ref: 'WS' }, - } + }, } template.Resources.WebsocketStage = { @@ -38,7 +38,7 @@ module.exports = function visitWebSockets (inventory, template) { StageName: deployStage, DeploymentId: { Ref: 'WebsocketDeployment' }, ApiId: { Ref: 'WS' }, - } + }, } // augment the lambdas role @@ -52,18 +52,18 @@ module.exports = function visitWebSockets (inventory, template) { Effect: 'Allow', Action: [ 'execute-api:Invoke', - 'execute-api:ManageConnections' + 'execute-api:ManageConnections', ], Resource: [ { 'Fn::Sub': [ 'arn:aws:execute-api:${AWS::Region}:*:${api}/*', - { api: { Ref: 'WS' } } - ] } - ] - } ] + { api: { Ref: 'WS' } }, + ] }, + ], + } ], }, - Roles: [ { Ref: 'Role' } ] - } + Roles: [ { Ref: 'Role' } ], + }, } inv.ws.forEach(route => { @@ -88,9 +88,9 @@ module.exports = function visitWebSockets (inventory, template) { RouteKey: defaults.includes(route.name) ? `$${route.name}` : route.name, OperationName: wsRoute, Target: { - 'Fn::Join': [ '/', [ 'integrations', { Ref: wsIntegration } ] ] - } - } + 'Fn::Join': [ '/', [ 'integrations', { Ref: wsIntegration } ] ], + }, + }, } template.Resources[wsIntegration] = { @@ -101,10 +101,10 @@ module.exports = function visitWebSockets (inventory, template) { IntegrationUri: { 'Fn::Sub': [ 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${' + wsLambda + '.Arn}/invocations', - {} - ] - } - } + {}, + ], + }, + }, } template.Resources[wsPermission] = { @@ -113,8 +113,8 @@ module.exports = function visitWebSockets (inventory, template) { Properties: { Action: 'lambda:InvokeFunction', FunctionName: { Ref: wsLambda }, - Principal: 'apigateway.amazonaws.com' - } + Principal: 'apigateway.amazonaws.com', + }, } }) @@ -124,9 +124,9 @@ module.exports = function visitWebSockets (inventory, template) { 'Fn::Sub': [ // Always default to staging; mutate to production via macro where necessary 'wss://${WS}.execute-api.${AWS::Region}.amazonaws.com/' + deployStage, - {} - ] - } + {}, + ], + }, } return template diff --git a/test/integration/integration-test.js b/test/integration/integration-test.js index a691fea..6681e3a 100644 --- a/test/integration/integration-test.js +++ b/test/integration/integration-test.js @@ -61,7 +61,7 @@ test('Transform SAM to CFN', t => { 'package', '--template-file', `sam.json`, '--output-template-file', `sam.yaml`, - '--s3-bucket', bucket + '--s3-bucket', bucket, ], function done (err) { if (err) t.fail(err) @@ -78,7 +78,7 @@ test('Deploy', t => { '--stack-name', 'PackageTestApp1', '--s3-bucket', bucket, '--capabilities', - 'CAPABILITY_IAM CAPABILITY_AUTO_EXPAND' + 'CAPABILITY_IAM CAPABILITY_AUTO_EXPAND', ], function done (err) { if (err) t.fail(err) diff --git a/test/integration/mock/src/http/get-api/index.js b/test/integration/mock/src/http/get-api/index.js index 5dd11c7..5f45c46 100644 --- a/test/integration/mock/src/http/get-api/index.js +++ b/test/integration/mock/src/http/get-api/index.js @@ -1,6 +1,6 @@ // an echo api exports.handler = async function http (req) { return { - body: JSON.stringify(req) + body: JSON.stringify(req), } } diff --git a/test/integration/mock/src/http/get-foo/index.js b/test/integration/mock/src/http/get-foo/index.js index 5dd11c7..5f45c46 100644 --- a/test/integration/mock/src/http/get-foo/index.js +++ b/test/integration/mock/src/http/get-foo/index.js @@ -1,6 +1,6 @@ // an echo api exports.handler = async function http (req) { return { - body: JSON.stringify(req) + body: JSON.stringify(req), } } diff --git a/test/unit/config-test.js b/test/unit/config-test.js index b4772c5..e5cab2d 100644 --- a/test/unit/config-test.js +++ b/test/unit/config-test.js @@ -289,7 +289,7 @@ layers let inv = await inventory({ rawArc, deployStage }) package(inv) } - catch (err) { + catch { t.pass('Too many layers fails') } @@ -301,7 +301,7 @@ layers a:b:c:us-west-2:d let inv = await inventory({ rawArc, deployStage }) package(inv) } - catch (err) { + catch { t.pass('Incorrect (.arc) layer region fails') } @@ -313,7 +313,7 @@ layers a:b:c:us-west-2:d let inv = await inventory({ rawArc, deployStage }) package(inv) } - catch (err) { + catch { t.pass('Incorrect (env) layer region fails') } delete process.env.AWS_REGION @@ -361,7 +361,7 @@ layers ${layer(2)} policies ${policy(2)} ` let tmp = mockTmp({ - 'src/events/an-event/.arc-config': Buffer.from(arcConfig) + 'src/events/an-event/.arc-config': Buffer.from(arcConfig), }) inv = await inventory({ cwd: tmp, rawArc, deployStage }) props = package(inv).Resources.AnEventEventLambda.Properties diff --git a/test/unit/visitors/tables-indexes/get-gsi-name-test.js b/test/unit/visitors/tables-indexes/get-gsi-name-test.js index a649bc2..61da569 100644 --- a/test/unit/visitors/tables-indexes/get-gsi-name-test.js +++ b/test/unit/visitors/tables-indexes/get-gsi-name-test.js @@ -4,7 +4,7 @@ let gsiName = require('../../../../src/visitors/tables-indexes/get-gsi-name') let index = { name: 'accounts', partitionKeyType: 'string', - partitionKey: 'email' + partitionKey: 'email', } test('get-gsi-name should throw is no partition key or partition key type is provided', t => {