Skip to content

Commit 45c6ceb

Browse files
feat(lint): clean up errors in base repo files
1 parent 8c114a4 commit 45c6ceb

File tree

6 files changed

+22
-18
lines changed

6 files changed

+22
-18
lines changed

__mocks__/got.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
shouldSucceed: true,
3-
post: function(url, options) {
3+
post: (url, options) => {
44
return new Promise((resolve, reject) => {
55
if (this.shouldSucceed) {
66
process.nextTick(resolve());
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
exports.handler = function(context, event, callback) {
2-
let twiml = new Twilio.twiml.MessagingResponse();
2+
const twiml = new Twilio.twiml.MessagingResponse();
33
twiml.message('Hello World');
44
callback(null, twiml);
55
};

_helpers/meta-template/tests/blank.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const handler = require('../functions/blank').handler;
1+
const { handler } = require('../functions/blank');
22

33
describe('{{name}} function template', () => {
44
it('Calls callback with empty JSON', () => {

_helpers/meta-template/tests/hello-messaging.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const helpers = require('../../test/test-helper');
1+
const helpers = require('../../../test/test-helper');
22
const helloVoice = require('../functions/hello-messaging.protected').handler;
33
const Twilio = require('twilio');
44

@@ -14,7 +14,7 @@ afterAll(() => {
1414
});
1515

1616
test('returns a VoiceResponse', done => {
17-
const callback = (err, result) => {
17+
const callback = (_err, result) => {
1818
expect(result).toBeInstanceOf(Twilio.twiml.MessagingResponse);
1919
done();
2020
};
@@ -23,7 +23,7 @@ test('returns a VoiceResponse', done => {
2323
});
2424

2525
test('says Hello World', done => {
26-
const callback = (err, result) => {
26+
const callback = (_err, result) => {
2727
expect(result.toString()).toMatch('<Message>Hello World</Message>');
2828
done();
2929
};

test/all-templates.test.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
'use strict';
2-
3-
// These tests verify that some important guarantees hold for all the functions
4-
// in the repository.
1+
/*
2+
* These tests verify that some important guarantees hold for all the functions
3+
* in the repository.
4+
*/
55

66
const path = require('path');
77
const fs = require('fs');
88
const { parser } = require('configure-env');
99

10-
// skipList is a list of function templates that don't pass verification
11-
// for now, but will in the long term
10+
/*
11+
* skipList is a list of function templates that don't pass verification
12+
* for now, but will in the long term
13+
*/
1214
const skipList = ['conversations', 'vaccine-standby'];
1315
const excludedPaths = ['node_modules', 'test', 'coverage', 'docs', 'blank'] + skipList;
1416
const projectRoot = path.resolve(__dirname, '..');
15-
// Assemble a list of template directories here, since templates.json
16-
// may not have all of them:
17+
/*
18+
* Assemble a list of template directories here, since templates.json
19+
* may not have all of them:
20+
*/
1721
const templates = fs
1822
.readdirSync(projectRoot, { withFileTypes: true })
1923
.filter(

test/test-helper.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,19 @@ const restoreEnv = (backupEnv) => {
8181
if (backupEnv === undefined) {
8282
return;
8383
}
84-
for (let key of Object.keys(process.env)) {
84+
for (const key of Object.keys(process.env)) {
8585
if (backupEnv[key] === undefined) {
8686
delete process.env[key];
8787
}
8888
}
89-
for (let key of Object.keys(backupEnv)) {
89+
for (const key of Object.keys(backupEnv)) {
9090
process.env[key] = backupEnv[key];
9191
}
9292
};
9393

9494
module.exports = {
95-
setup: setup,
96-
teardown: teardown,
95+
setup,
96+
teardown,
9797
MockRuntime,
9898
backupEnv,
9999
restoreEnv

0 commit comments

Comments
 (0)