diff --git a/src/events/publish.js b/src/events/publish.js index fd611412..d32a2656 100644 --- a/src/events/publish.js +++ b/src/events/publish.js @@ -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) @@ -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 diff --git a/src/events/subscribe.js b/src/events/subscribe.js index 1ca91724..6310940d 100644 --- a/src/events/subscribe.js +++ b/src/events/subscribe.js @@ -2,8 +2,8 @@ let parallel = require('run-parallel') let fallback = { Records: [ - { Sns: { Message: JSON.stringify({}) } } - ] + { Sns: { Message: JSON.stringify({}) } }, + ], } /** diff --git a/src/http/_res-fmt.js b/src/http/_res-fmt.js index 0f44d617..fc75d6d7 100644 --- a/src/http/_res-fmt.js +++ b/src/http/_res-fmt.js @@ -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 diff --git a/src/http/errors/index.js b/src/http/errors/index.js index 0299c3b7..4638a543 100644 --- a/src/http/errors/index.js +++ b/src/http/errors/index.js @@ -5,7 +5,7 @@ module.exports = function httpError (params) { let { statusCode = 502, title = 'Unknown error', - message = '' + message = '', } = params title = title === 'Error' ? `${statusCode} error` @@ -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: ` @@ -83,6 +83,6 @@ module.exports = function httpError (params) { -` +`, } } diff --git a/src/http/helpers/binary-types.js b/src/http/helpers/binary-types.js index 983c0589..4b406ed2 100644 --- a/src/http/helpers/binary-types.js +++ b/src/http/helpers/binary-types.js @@ -58,5 +58,5 @@ module.exports = [ 'application/x-rar-compressed', 'application/x-tar', 'application/x-zip', - 'application/zip' + 'application/zip', ] diff --git a/src/http/helpers/body-parser.js b/src/http/helpers/body-parser.js index 2f76f0ab..0b63084f 100644 --- a/src/http/helpers/body-parser.js +++ b/src/http/helpers/body-parser.js @@ -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') } } diff --git a/src/http/helpers/csrf.js b/src/http/helpers/csrf.js index 67665c2b..95f17798 100644 --- a/src/http/helpers/csrf.js +++ b/src/http/helpers/csrf.js @@ -7,7 +7,7 @@ module.exports = function _csrf (req, res, next) { else { res({ status: 403, - html: 'invalid csrf token' + html: 'invalid csrf token', }) } } diff --git a/src/http/session/providers/ddb/create.js b/src/http/session/providers/ddb/create.js index 46a62456..fd4d9029 100644 --- a/src/http/session/providers/ddb/create.js +++ b/src/http/session/providers/ddb/create.js @@ -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 @@ -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) }) }) diff --git a/src/http/session/providers/ddb/find.js b/src/http/session/providers/ddb/find.js index 0c64f3e6..0d663824 100644 --- a/src/http/session/providers/ddb/find.js +++ b/src/http/session/providers/ddb/find.js @@ -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 diff --git a/src/http/session/providers/ddb/index.js b/src/http/session/providers/ddb/index.js index 64570a94..6874b561 100644 --- a/src/http/session/providers/ddb/index.js +++ b/src/http/session/providers/ddb/index.js @@ -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: '/', diff --git a/src/http/session/providers/ddb/update.js b/src/http/session/providers/ddb/update.js index b08930ff..dacaed45 100644 --- a/src/http/session/providers/ddb/update.js +++ b/src/http/session/providers/ddb/update.js @@ -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) }) } diff --git a/src/http/session/providers/jwe.js b/src/http/session/providers/jwe.js index ffd7e5b4..741a9017 100644 --- a/src/http/session/providers/jwe.js +++ b/src/http/session/providers/jwe.js @@ -46,7 +46,7 @@ let jwe = { setupCrypto() const WEEK = 604800 return jwt.parse(token).setTokenLifetime(WEEK).verify(key) - } + }, } /** @@ -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: '/', diff --git a/src/index.js b/src/index.js index 70f27a8f..b02ca20b 100644 --- a/src/index.js +++ b/src/index.js @@ -38,7 +38,7 @@ let arc = { } }) }) - } + }, } arc.events = require('./events')(arc, 'events') arc.queues = require('./events')(arc, 'queues') diff --git a/src/lib/_get-ports.js b/src/lib/_get-ports.js index bf5906ee..ccfb2f0b 100644 --- a/src/lib/_get-ports.js +++ b/src/lib/_get-ports.js @@ -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) diff --git a/src/tables/factory.js b/src/tables/factory.js index 5d7820d2..2c48eaf8 100644 --- a/src/tables/factory.js +++ b/src/tables/factory.js @@ -137,7 +137,7 @@ function dynamoConstructor (params, callback) { update (params, callback) { return go(aws.dynamodb.UpdateItem, { ...params, TableName }, callback) - } + }, } } callback(null, data) diff --git a/src/tables/index.js b/src/tables/index.js index 38d90979..86ed690f 100644 --- a/src/tables/index.js +++ b/src/tables/index.js @@ -43,7 +43,7 @@ module.exports = function tables (arc) { function (created, callback) { client = created callback(null, client) - } + }, ], callback) } return promise diff --git a/src/tables/legacy.js b/src/tables/legacy.js index a115185e..45f4096e 100644 --- a/src/tables/legacy.js +++ b/src/tables/legacy.js @@ -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 @@ -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) @@ -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) diff --git a/src/tables/old.js b/src/tables/old.js index 5b1c576c..122d3bae 100644 --- a/src/tables/old.js +++ b/src/tables/old.js @@ -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' ]), } diff --git a/src/ws/index.js b/src/ws/index.js index 75ee1c7e..b88947ab 100644 --- a/src/ws/index.js +++ b/src/ws/index.js @@ -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 { diff --git a/test/integration/http-assets.js b/test/integration/http-assets.js index 8c7b6eb8..8b173733 100644 --- a/test/integration/http-assets.js +++ b/test/integration/http-assets.js @@ -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` diff --git a/test/integration/http-session-jwe-test.js b/test/integration/http-session-jwe-test.js index f4c6bac9..67fd1ba5 100644 --- a/test/integration/http-session-jwe-test.js +++ b/test/integration/http-session-jwe-test.js @@ -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') } diff --git a/test/integration/static-fingerprinted-test.js b/test/integration/static-fingerprinted-test.js index 720d7bda..d635cdd2 100644 --- a/test/integration/static-fingerprinted-test.js +++ b/test/integration/static-fingerprinted-test.js @@ -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 }) @@ -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') }) diff --git a/test/integration/static-plain-test.js b/test/integration/static-plain-test.js index 5721d638..348aa23d 100644 --- a/test/integration/static-plain-test.js +++ b/test/integration/static-plain-test.js @@ -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 }) diff --git a/test/integration/tables-test.js b/test/integration/tables-test.js index ed6bd0f2..972f915c 100644 --- a/test/integration/tables-test.js +++ b/test/integration/tables-test.js @@ -21,7 +21,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') t.ok(exists(join(shared, 'static.json')), 'Mock static.json file ready') - // eslint-disable-next-line + arc = require('../..') // module globally inspects arc file so need to require after chdir }) @@ -67,15 +67,15 @@ test('tables put()', async t => { foo: 'bar', baz: { one: 1, - doe: true - } + doe: true, + }, }) t.ok(item, 'returned item') item = null item = await data['accounts-messages'].put({ accountID: 'fake', msgID: 'alsofake', - extra: true + extra: true, }) t.ok(item, `returned item`) }) @@ -83,14 +83,14 @@ test('tables put()', async t => { test('tables get()', async t => { t.plan(4) let result = await data.accounts.get({ - accountID: 'fake' + accountID: 'fake', }) t.ok(result, 'got accounts table result') t.ok(result.baz.doe, 'result.baz.doe deserialized') result = null result = await data['accounts-messages'].get({ accountID: 'fake', - msgID: 'alsofake' + msgID: 'alsofake', }) t.ok(result, 'got accounts-messages table result') t.ok(result.extra, 'result.extra deserialized') @@ -99,21 +99,21 @@ test('tables get()', async t => { test('tables delete()', async t => { t.plan(4) await data.accounts.delete({ - accountID: 'fake' + accountID: 'fake', }) t.ok(true, 'deleted') let result = await data.accounts.get({ - accountID: 'fake' + accountID: 'fake', }) t.equal(result, undefined, 'could not get deleted accounts item') await data['accounts-messages'].delete({ accountID: 'fake', - msgID: 'alsofake' + msgID: 'alsofake', }) t.ok(true, 'deleted') let otherResult = await data['accounts-messages'].get({ accountID: 'fake', - msgID: 'alsofake' + msgID: 'alsofake', }) t.equal(otherResult, undefined, 'could not get deleted accounts-messages item') }) @@ -132,7 +132,7 @@ test('tables query()', async t => { KeyConditionExpression: 'accountID = :id', ExpressionAttributeValues: { ':id': 'one', - } + }, }) t.ok(result, 'got a result') @@ -144,8 +144,8 @@ test('tables scan()', async t => { let result = await data.accounts.scan({ FilterExpression: 'accountID = :id', ExpressionAttributeValues: { - ':id': 'two' - } + ':id': 'two', + }, }) t.ok(result, 'got a result') }) @@ -161,21 +161,21 @@ test('tables update()', async t => { t.plan(3) await data.accounts.update({ Key: { - accountID: 'three' + accountID: 'three', }, UpdateExpression: 'set #hits = :hits', ExpressionAttributeNames: { - '#hits': 'hits' + '#hits': 'hits', }, ExpressionAttributeValues: { ':hits': 20, - } + }, }) t.ok(true, 'updated without error') let result = await data.accounts.get({ - accountID: 'three' + accountID: 'three', }) t.ok(result, 'got result') diff --git a/test/mock/project/src/http/get-http_async_session/index.js b/test/mock/project/src/http/get-http_async_session/index.js index a0cbb304..5c87a0e1 100644 --- a/test/mock/project/src/http/get-http_async_session/index.js +++ b/test/mock/project/src/http/get-http_async_session/index.js @@ -1,6 +1,6 @@ let arc = require('../../../../../../src') -// eslint-disable-next-line + async function handler (req) { let { query, session } = req if (query.session === 'create') { @@ -14,7 +14,7 @@ async function handler (req) { } return { session, - json: JSON.stringify(session) + json: JSON.stringify(session), } } diff --git a/test/mock/project/src/http/get-http_session/index.js b/test/mock/project/src/http/get-http_session/index.js index 7413c802..b8fce6f0 100644 --- a/test/mock/project/src/http/get-http_session/index.js +++ b/test/mock/project/src/http/get-http_session/index.js @@ -13,7 +13,7 @@ function handler (req, res) { } res({ session, - json: JSON.stringify(session) + json: JSON.stringify(session), }) } diff --git a/test/mock/project/src/http/post-publish_event-catchall/index.js b/test/mock/project/src/http/post-publish_event-catchall/index.js index 00d55acf..d20abcbe 100644 --- a/test/mock/project/src/http/post-publish_event-catchall/index.js +++ b/test/mock/project/src/http/post-publish_event-catchall/index.js @@ -8,7 +8,7 @@ exports.handler = async function (req) { let payload = { ok: true } await arc[type].publish({ name, - payload + payload, }) return payload } diff --git a/test/mock/project/src/plugins/services.js b/test/mock/project/src/plugins/services.js index 4b22ad6f..db8eecbb 100644 --- a/test/mock/project/src/plugins/services.js +++ b/test/mock/project/src/plugins/services.js @@ -3,13 +3,13 @@ module.exports = { services: async () => { return { tables: { - stuff: 'so-very-much-stuff' + stuff: 'so-very-much-stuff', }, 'cloudwatch/metrics': { foo: 'bar', fiz: 'buz', - } + }, } - } - } + }, + }, } diff --git a/test/mock/project/src/ws/connect/index.js b/test/mock/project/src/ws/connect/index.js index da990a24..15ef8e3c 100644 --- a/test/mock/project/src/ws/connect/index.js +++ b/test/mock/project/src/ws/connect/index.js @@ -1,8 +1,8 @@ -// eslint-disable-next-line require-await + async function handler () { console.log('connect') return { - statusCode: 200 + statusCode: 200, } } diff --git a/test/mock/project/src/ws/default/index.js b/test/mock/project/src/ws/default/index.js index 94010454..fe0793ab 100644 --- a/test/mock/project/src/ws/default/index.js +++ b/test/mock/project/src/ws/default/index.js @@ -14,7 +14,7 @@ async function handler (event) { await arc.ws.close({ id: connectionId }) } return { - statusCode: 200 + statusCode: 200, } } exports.handler = handler diff --git a/test/mock/project/src/ws/disconnect/index.js b/test/mock/project/src/ws/disconnect/index.js index 3f4eff0a..8cef62ca 100644 --- a/test/mock/project/src/ws/disconnect/index.js +++ b/test/mock/project/src/ws/disconnect/index.js @@ -1,8 +1,8 @@ -// eslint-disable-next-line require-await + async function handler () { console.log('disconnect') return { - statusCode: 200 + statusCode: 200, } } diff --git a/test/unit/src/events/publish-test.js b/test/unit/src/events/publish-test.js index 9f98685a..d6496c1e 100644 --- a/test/unit/src/events/publish-test.js +++ b/test/unit/src/events/publish-test.js @@ -3,7 +3,7 @@ let publish test('Set up env', t => { t.plan(1) - // eslint-disable-next-line + let arc = require('../../../..') publish = arc.events.publish t.ok(publish, 'Got events.publish method') @@ -16,7 +16,7 @@ test('events.publish should throw if there is no parameter name', t => { test('events.publish should throw if there is no parameter payload', t => { t.plan(1) - t.throws(() => { publish({ name: 'batman' })}, /missing params.payload/, 'throws missing payload parameter exception') + t.throws(() => { publish({ name: 'batman' }) }, /missing params.payload/, 'throws missing payload parameter exception') }) test('Teardown', t => { diff --git a/test/unit/src/events/subscribe-test.js b/test/unit/src/events/subscribe-test.js index 12381c16..2663821e 100644 --- a/test/unit/src/events/subscribe-test.js +++ b/test/unit/src/events/subscribe-test.js @@ -4,7 +4,7 @@ let subscribe test('Set up env', t => { t.plan(1) - // eslint-disable-next-line + let arc = require('../../../..') subscribe = arc.events.subscribe t.ok(subscribe, 'Got events.subscribe method') @@ -15,7 +15,7 @@ test('events.subscribe should invoke provided handler for each SNS event Record' let fake = sinon.fake.yields() let handler = subscribe(fake) handler({ - Records: [ { Sns: { Message: '{"hey":"there"}' } }, { Sns: { Message: '{"sup":"bud"}' } } ] + Records: [ { Sns: { Message: '{"hey":"there"}' } }, { Sns: { Message: '{"sup":"bud"}' } } ], }, {}, function (err) { if (err) t.fail(err) else { @@ -32,7 +32,7 @@ test('events.subscribe should invoke provided handler for each SNS event Record await fake(json) }) await handler({ - Records: [ { Sns: { Message: '{"hey":"there"}' } }, { Sns: { Message: '{"sup":"bud"}' } } ] + Records: [ { Sns: { Message: '{"hey":"there"}' } }, { Sns: { Message: '{"sup":"bud"}' } } ], }) t.ok(fake.calledWith({ hey: 'there' }), 'subscribe handler called with first SNS record') t.ok(fake.calledWith({ sup: 'bud' }), 'subscribe handler called with second SNS record') diff --git a/test/unit/src/http/helpers/body-parser-test.js b/test/unit/src/http/helpers/body-parser-test.js index 90aef9ae..acf36072 100644 --- a/test/unit/src/http/helpers/body-parser-test.js +++ b/test/unit/src/http/helpers/body-parser-test.js @@ -28,14 +28,14 @@ test('Architect v10+ requests', t => { let req = { body: hiText, headers: text, - isBase64Encoded: false + isBase64Encoded: false, } t.equals(parseBody(req), 'hi there', `body matches ${str(req.body)}`) req = { body: b64encode(hiText), headers: text, - isBase64Encoded: true + isBase64Encoded: true, } t.equals(parseBody(req), 'hi there', `body matches ${str(req.body)}`) @@ -43,28 +43,28 @@ test('Architect v10+ requests', t => { req = { body: hiXml, headers: xmlText, - isBase64Encoded: false + isBase64Encoded: false, } t.equals(parseBody(req), hiXml, `body matches ${str(req.body)}`) req = { body: hiXml, headers: xmlApp, - isBase64Encoded: false + isBase64Encoded: false, } t.equals(parseBody(req), hiXml, `body matches ${str(req.body)}`) req = { body: b64encode(hiXml), headers: xmlText, - isBase64Encoded: true + isBase64Encoded: true, } t.equals(parseBody(req), hiXml, `body matches ${str(req.body)}`) req = { body: b64encode(hiXml), headers: xmlApp, - isBase64Encoded: true + isBase64Encoded: true, } t.equals(parseBody(req), hiXml, `body matches ${str(req.body)}`) }) @@ -75,21 +75,21 @@ test('Architect v6+ requests', t => { let req = { body: str(hi), headers: json, - isBase64Encoded: false + isBase64Encoded: false, } t.equals(str(parseBody(req)), str(hi), `body matches ${req.body}`) // Pass through empty body (although in practice we'll never see this, as we transform to empty object) req = { body: null, - headers: json + headers: json, } t.equals(str(parseBody(req)), str(null), `body matches ${str(req.body)}`) req = { body: b64encode(str(hi)), headers: json, - isBase64Encoded: true + isBase64Encoded: true, } t.equals(str(parseBody(req)), str(hi), `body matches ${str(req.body)}`) @@ -97,7 +97,7 @@ test('Architect v6+ requests', t => { req = { body: b64encode(str(hi)), headers: { 'Content-Type': 'application/vnd.api+json' }, - isBase64Encoded: true + isBase64Encoded: true, } t.equals(str(parseBody(req)), str(hi), `body matches ${str(req.body)}`) @@ -110,7 +110,7 @@ test('Architect v6+ requests', t => { req = { body: hiFormURL, headers: formURLencoded, - isBase64Encoded: true + isBase64Encoded: true, } t.equals(str(parseBody(req)), str(hi), `body matches ${str(req.body)}`) // Not testing faulty encoding on form URL-encoded posts; you'll always get something back @@ -119,7 +119,7 @@ test('Architect v6+ requests', t => { req = { body: hiBase64file, headers: multiPartFormData, - isBase64Encoded: true + isBase64Encoded: true, } t.equals(str(parseBody(req)), str({ base64: hiBase64file }), `body matches ${str(req.body)}`) @@ -134,28 +134,28 @@ test('Architect v5 requests', t => { // Pass through empty body let req = { body: {}, - headers: json + headers: json, } t.equals(parseBody(req), req.body, `body matches ${str(req.body)}`) // Pass through parsed body (JSON) req = { body: hi, - headers: json + headers: json, } t.equals(str(parseBody(req)), str(hi), `body matches ${str(req.body)}`) // Pass through parsed body (formURLencoded) req = { body: hi, - headers: formURLencoded + headers: formURLencoded, } t.equals(str(parseBody(req)), str(hi), `body matches ${str(req.body)}`) // Pass through multipart / base64 req = { body: hiBase64, - headers: multiPartFormData + headers: multiPartFormData, } t.equals(str(parseBody(req)), str(hiBase64), `body matches ${str(req.body)}`) diff --git a/test/unit/src/http/index-async-req-test.js b/test/unit/src/http/index-async-req-test.js index e74cdc69..4e79e8e6 100644 --- a/test/unit/src/http/index-async-req-test.js +++ b/test/unit/src/http/index-async-req-test.js @@ -1,4 +1,4 @@ -/* eslint-disable require-await */ + let { join } = require('path') let { deepStrictEqual } = require('assert') let sut = join(process.cwd(), 'src') @@ -19,7 +19,7 @@ let isNulled = key => arc6RestNull.some(v => v === key) let arc6RestPrettyParams = { method: 'httpMethod', params: 'pathParameters', - query: 'queryStringParameters' + query: 'queryStringParameters', } let requestsTested = [] @@ -62,7 +62,7 @@ test('Set up env', t => { t.plan(2) // Set env var to keep from stalling on db reads in CI process.env.ARC_SESSION_TABLE_NAME = 'jwe' - // eslint-disable-next-line + arc = require(sut) t.ok(arc.http, 'Loaded HTTP') t.ok(arc.http.async, 'Loaded legacy async method') @@ -521,7 +521,7 @@ test('Verify all Arc v7 (HTTP) + Arc v6 (REST) request fixtures were tested', t deepStrictEqual(req, tested) return true } - catch (err) { /* noop */ } + catch { /* noop */ } }), `Tested req: ${name}`) } console.log(`Arc 7 requests`) diff --git a/test/unit/src/http/index-async-res-test.js b/test/unit/src/http/index-async-res-test.js index bf8ad531..439db4ae 100644 --- a/test/unit/src/http/index-async-res-test.js +++ b/test/unit/src/http/index-async-res-test.js @@ -1,4 +1,4 @@ -/* eslint-disable require-await */ + let { join } = require('path') let { brotliDecompressSync, gunzipSync } = require('zlib') let { deepStrictEqual } = require('assert') @@ -32,7 +32,7 @@ test('Set up env', t => { t.plan(1) // Set env var to keep from stalling on db reads in CI process.env.ARC_SESSION_TABLE_NAME = 'jwe' - // eslint-disable-next-line + arc = require(sut) t.ok(arc.http, 'Loaded HTTP') }) @@ -497,7 +497,7 @@ test('Verify all Arc v7 (HTTP) + Arc v6 (REST) + legacy response fixtures were t deepStrictEqual(req, tested) return true } - catch (err) { /* noop */ } + catch { /* noop */ } }), `Tested res: ${name}`) } console.log(`Arc 7 responses`) diff --git a/test/unit/src/http/index-cb-req-test.js b/test/unit/src/http/index-cb-req-test.js index b5936d6d..5d9a05d9 100644 --- a/test/unit/src/http/index-cb-req-test.js +++ b/test/unit/src/http/index-cb-req-test.js @@ -18,7 +18,7 @@ let isNulled = key => arc6RestNull.some(v => v === key) let arc6RestPrettyParams = { method: 'httpMethod', params: 'pathParameters', - query: 'queryStringParameters' + query: 'queryStringParameters', } let requestsTested = [] @@ -66,7 +66,7 @@ test('Set up env', t => { t.plan(1) // Set env var to keep from stalling on db reads in CI process.env.ARC_SESSION_TABLE_NAME = 'jwe' - // eslint-disable-next-line + let arc = require(sut) http = arc.http t.ok(http, 'Loaded HTTP') @@ -396,7 +396,7 @@ test('Verify all Arc v7 (HTTP) + Arc v6 (REST) request fixtures were tested', t deepStrictEqual(req, tested) return true } - catch (err) { /* noop */ } + catch { /* noop */ } }), `Tested req: ${name}`) } console.log(`Arc 7 requests`) diff --git a/test/unit/src/http/index-cb-res-test.js b/test/unit/src/http/index-cb-res-test.js index 9287fafc..f32a23b6 100644 --- a/test/unit/src/http/index-cb-res-test.js +++ b/test/unit/src/http/index-cb-res-test.js @@ -29,7 +29,7 @@ test('Set up env', t => { t.plan(1) // Init env var to keep from stalling on db reads in CI process.env.ARC_SESSION_TABLE_NAME = 'jwe' - // eslint-disable-next-line + let arc = require(sut) http = arc.http t.ok(http, 'Loaded HTTP') @@ -538,7 +538,7 @@ test('Verify all Arc v7 (HTTP) + Arc v6 (REST) + legacy response fixtures were t deepStrictEqual(req, tested) return true } - catch (err) { /* noop */ } + catch { /* noop */ } }), `Tested res: ${name}`) } console.log(`Arc 7 responses`) diff --git a/test/unit/src/queues/publish-test.js b/test/unit/src/queues/publish-test.js index a7469399..7364940a 100644 --- a/test/unit/src/queues/publish-test.js +++ b/test/unit/src/queues/publish-test.js @@ -3,7 +3,7 @@ let publish test('Set up env', t => { t.plan(1) - // eslint-disable-next-line + let arc = require('../../../..') publish = arc.queues.publish t.ok(publish, 'Got queues.publish method') @@ -16,7 +16,7 @@ test('queues.publish should throw if there is no parameter name', t => { test('queues.publish should throw if there is no parameter payload', t => { t.plan(1) - t.throws(() => { publish({ name: 'batman' })}, /missing params.payload/, 'throws missing payload parameter exception') + t.throws(() => { publish({ name: 'batman' }) }, /missing params.payload/, 'throws missing payload parameter exception') }) test('Teardown', t => { diff --git a/test/unit/src/queues/subscribe-test.js b/test/unit/src/queues/subscribe-test.js index f32ece46..4c32bb61 100644 --- a/test/unit/src/queues/subscribe-test.js +++ b/test/unit/src/queues/subscribe-test.js @@ -5,7 +5,7 @@ let subscribe test('Set up env', t => { t.plan(1) - // eslint-disable-next-line + let arc = require('../../../..') subscribe = arc.queues.subscribe t.ok(subscribe, 'Got queues.subscribe method') @@ -37,7 +37,7 @@ test('queues.subscribe calls async handler', async t => { let fake = sinon.fake() // get a lambda signature from the handler - // eslint-disable-next-line + let handler = subscribe(async function (json) { fake(json) }) diff --git a/test/unit/src/static/index-test.js b/test/unit/src/static/index-test.js index 05863006..9a9e324c 100644 --- a/test/unit/src/static/index-test.js +++ b/test/unit/src/static/index-test.js @@ -4,9 +4,9 @@ let proxyquire = require('proxyquire') let manifestExists = true let fs = { readFileSync: () => (JSON.stringify({ - 'foo.png': 'foo-1a2b3d.png' + 'foo.png': 'foo-1a2b3d.png', })), - existsSync: () => manifestExists + existsSync: () => manifestExists, } let arcStatic = proxyquire('../../../../src/static', { fs }) diff --git a/test/unit/src/tables/factory-test.js b/test/unit/src/tables/factory-test.js index 5b3713f8..a274c15f 100644 --- a/test/unit/src/tables/factory-test.js +++ b/test/unit/src/tables/factory-test.js @@ -7,7 +7,7 @@ let mock = join(cwd, 'test', 'mock', 'project') let noop = () => {} let factory = proxyquire('../../../../src/tables/factory', { - './legacy': () => ({ db: noop, doc: noop }) + './legacy': () => ({ db: noop, doc: noop }), }) let services = { tables: { hi: 'there' } }