Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanblock committed Apr 29, 2024
1 parent 7a55699 commit 4a9a26c
Show file tree
Hide file tree
Showing 42 changed files with 110 additions and 110 deletions.
4 changes: 2 additions & 2 deletions src/events/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function eventFactory (arc) {
function publish (arn, payload, callback) {
client.sns.Publish({
TopicArn: arn,
Message: JSON.stringify(payload)
Message: JSON.stringify(payload),
})
.then(result => callback(null, result))
.catch(callback)
Expand Down Expand Up @@ -121,7 +121,7 @@ function queueFactory (arc) {
let params = {
QueueUrl: url,
DelaySeconds: delaySeconds || 0,
MessageBody: JSON.stringify(payload)
MessageBody: JSON.stringify(payload),
}
if (url.endsWith('.fifo')) {
params.MessageGroupId = groupID || name
Expand Down
4 changes: 2 additions & 2 deletions src/events/subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ let parallel = require('run-parallel')

let fallback = {
Records: [
{ Sns: { Message: JSON.stringify({}) } }
]
{ Sns: { Message: JSON.stringify({}) } },
],
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/http/_res-fmt.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ module.exports = function responseFormatter (req, params) {
let res = {
headers: Object.assign({}, { 'content-type': type }, params.headers || {}),
statusCode,
body
body,
}

// REST API stuff
Expand Down
6 changes: 3 additions & 3 deletions src/http/errors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = function httpError (params) {
let {
statusCode = 502,
title = 'Unknown error',
message = ''
message = '',
} = params
title = title === 'Error'
? `${statusCode} error`
Expand All @@ -14,7 +14,7 @@ module.exports = function httpError (params) {
statusCode,
headers: {
'content-type': 'text/html; charset=utf8;',
'cache-control': 'no-cache, no-store, must-revalidate, max-age=0, s-maxage=0'
'cache-control': 'no-cache, no-store, must-revalidate, max-age=0, s-maxage=0',
},
body: `
<!DOCTYPE html>
Expand Down Expand Up @@ -83,6 +83,6 @@ module.exports = function httpError (params) {
</div>
</body>
</html>
`
`,
}
}
2 changes: 1 addition & 1 deletion src/http/helpers/binary-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ module.exports = [
'application/x-rar-compressed',
'application/x-tar',
'application/x-zip',
'application/zip'
'application/zip',
]
2 changes: 1 addition & 1 deletion src/http/helpers/body-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = function parseBody (req) {
: request.body
request.body = JSON.parse(data) || {}
}
catch (e) {
catch {
throw Error('Invalid request body encoding or invalid JSON')
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/http/helpers/csrf.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = function _csrf (req, res, next) {
else {
res({
status: 403,
html: 'invalid csrf token'
html: 'invalid csrf token',
})
}
}
4 changes: 2 additions & 2 deletions src/http/session/providers/ddb/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = function _create (name, payload, callback) {
if (err) callback(err)
else callback(null, { _secret: val })
})
}
},
],
function _put (err, results) {
if (err) throw err
Expand All @@ -29,7 +29,7 @@ module.exports = function _create (name, payload, callback) {
if (err) callback(err)
else data._client.PutItem({
TableName: name,
Item: session
Item: session,
}).then(() => callback(null, session)).catch(callback)
})
})
Expand Down
2 changes: 1 addition & 1 deletion src/http/session/providers/ddb/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function _find (name, _idx, callback) {
else data._client.GetItem({
TableName: name,
ConsistentRead: true,
Key: { _idx }
Key: { _idx },
})
.then(item => {
let result = typeof item === 'undefined' ? false : item.Item
Expand Down
2 changes: 1 addition & 1 deletion src/http/session/providers/ddb/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function write (params, callback) {
let sameSite = ARC_SESSION_SAME_SITE || 'lax'
let options = {
maxAge,
expires: new Date(Date.now() + maxAge * 1000),
expires: new Date(Date.now() + (maxAge * 1000)),
secure: true,
httpOnly: true,
path: '/',
Expand Down
2 changes: 1 addition & 1 deletion src/http/session/providers/ddb/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function _update (name, payload, callback) {
if (err) callback(err)
else data._client.PutItem({
TableName: name,
Item: session
Item: session,
}).then(() => callback(null, session)).catch(callback)
})
}
4 changes: 2 additions & 2 deletions src/http/session/providers/jwe.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ let jwe = {
setupCrypto()
const WEEK = 604800
return jwt.parse(token).setTokenLifetime(WEEK).verify(key)
}
},
}

/**
Expand Down Expand Up @@ -99,7 +99,7 @@ function write (payload, callback) {
let sameSite = ARC_SESSION_SAME_SITE || 'lax'
let options = {
maxAge,
expires: new Date(Date.now() + maxAge * 1000),
expires: new Date(Date.now() + (maxAge * 1000)),
secure: true,
httpOnly: true,
path: '/',
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ let arc = {
}
})
})
}
},
}
arc.events = require('./events')(arc, 'events')
arc.queues = require('./events')(arc, 'queues')
Expand Down
2 changes: 1 addition & 1 deletion src/lib/_get-ports.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function getPorts (callback) {
// Fall back to an internal SSM query in case Functions is running as a bare module
else {
// Require in here or circular dep warnings may occur
// eslint-disable-next-line

let discovery = require('../discovery')
discovery((err, services) => {
if (err) callback(err)
Expand Down
2 changes: 1 addition & 1 deletion src/tables/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function dynamoConstructor (params, callback) {

update (params, callback) {
return go(aws.dynamodb.UpdateItem, { ...params, TableName }, callback)
}
},
}
}
callback(null, data)
Expand Down
2 changes: 1 addition & 1 deletion src/tables/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = function tables (arc) {
function (created, callback) {
client = created
callback(null, client)
}
},
], callback)
}
return promise
Expand Down
14 changes: 7 additions & 7 deletions src/tables/legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ module.exports = function getLegacyDynamoClients ({ port, region }) {
let DB, Doc

if (isNode18) {
// eslint-disable-next-line

let dynamo = require('@aws-sdk/client-dynamodb')
// eslint-disable-next-line

let docclient = require('@aws-sdk/lib-dynamodb')
DB = dynamo.DynamoDB
Doc = docclient.DynamoDBDocument
}
else {
// eslint-disable-next-line

let dynamo = require('aws-sdk/clients/dynamodb')
DB = dynamo
Doc = dynamo.DocumentClient
Expand All @@ -37,8 +37,8 @@ module.exports = function getLegacyDynamoClients ({ port, region }) {
keepAlive: true,
maxSockets: 50, // Node can set to Infinity; AWS maxes at 50
rejectUnauthorized: true,
})
}
}),
},
}
}
client.db = new DB(config)
Expand All @@ -53,10 +53,10 @@ module.exports = function getLegacyDynamoClients ({ port, region }) {
if (isNode18) {
// Disable keep-alive locally (or wait Node's default 5s for sockets to time out)
let http = require('http')
// eslint-disable-next-line

let { NodeHttpHandler } = require('@smithy/node-http-handler')
config.requestHandler = new NodeHttpHandler({
httpAgent: new http.Agent({ keepAlive: false })
httpAgent: new http.Agent({ keepAlive: false }),
})
}
client.db = new DB(config)
Expand Down
10 changes: 5 additions & 5 deletions src/tables/old.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ function __trigger (types, handler) {
}
}

/* eslint-disable indent */

module.exports = {
insert: __trigger.bind({}, [ 'INSERT' ]),
modify: __trigger.bind({}, [ 'MODIFY' ]),
update: __trigger.bind({}, [ 'MODIFY' ]),
remove: __trigger.bind({}, [ 'REMOVE' ]),
destroy: __trigger.bind({}, [ 'REMOVE' ]),
all: __trigger.bind({}, [ 'INSERT', 'MODIFY', 'REMOVE' ]),
save: __trigger.bind({}, [ 'INSERT', 'MODIFY' ]),
change: __trigger.bind({}, [ 'INSERT', 'REMOVE' ])
destroy: __trigger.bind({}, [ 'REMOVE' ]),
all: __trigger.bind({}, [ 'INSERT', 'MODIFY', 'REMOVE' ]),
save: __trigger.bind({}, [ 'INSERT', 'MODIFY' ]),
change: __trigger.bind({}, [ 'INSERT', 'REMOVE' ]),
}
2 changes: 1 addition & 1 deletion src/ws/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function instantiateAPI () {
if (client) res(client)

getAwsClient({
plugins: [ import('@aws-lite/apigatewaymanagementapi') ]
plugins: [ import('@aws-lite/apigatewaymanagementapi') ],
}, (err, _client) => {
if (err) rej(err)
else {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/http-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let port = process.env.PORT ? process.env.PORT : '3333'
let url = s => `http://localhost:${port}${s ? s : ''}`
let mock = join(__dirname, '..', 'mock', 'project')
let compress = {
'accept-encoding': 'br'
'accept-encoding': 'br',
}
let css = `/* css here! */\n`
let js = `/* js here! */\n`
Expand Down
2 changes: 1 addition & 1 deletion test/integration/http-session-jwe-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function getSession (url) {
}

function checkKeys (session, t) {
let { iat, } = session
let { iat } = session
if (!iat) t.fail(`Did not get back all internal session keys: ${JSON.stringify(session, null, 2)}`)
else t.pass('Got back internal session key: iat')
}
Expand Down
4 changes: 2 additions & 2 deletions test/integration/static-fingerprinted-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test('Set up mocked arc', t => {
t.ok(exists(join(shared, '.arc')), 'Mock .arc (shared) file ready')
t.ok(exists(join(tmp, '.arc')), 'Mock .arc (root) file ready')
process.chdir(tmp)
// eslint-disable-next-line

arc = require('../..') // module globally inspects arc file so need to require after chdir
})

Expand All @@ -34,7 +34,7 @@ test('Set up mocked static manifest', t => {
t.plan(2)
copyFileSync(join(mock, 'mock-static'), join(shared, 'static.json'))
t.ok(exists(join(shared, 'static.json')), 'Mock static.json file ready')
// eslint-disable-next-line

static = require(join(shared, 'static.json'))
t.ok(static['index.html'], 'Static manifest loaded')
})
Expand Down
2 changes: 1 addition & 1 deletion test/integration/static-plain-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test('Set up mocked files', t => {
t.ok(exists(join(shared, '.arc')), 'Mock .arc (shared) file ready')
t.ok(exists(join(tmp, '.arc')), 'Mock .arc (root) file ready')
process.chdir(tmp)
// eslint-disable-next-line

arc = require('../..') // module globally inspects arc file so need to require after chdir
})

Expand Down
Loading

0 comments on commit 4a9a26c

Please sign in to comment.