Skip to content

Commit 71beb6c

Browse files
authored
chore(deps): dependency updates and lint fixes
1 parent d5784e7 commit 71beb6c

File tree

13 files changed

+11893
-16102
lines changed

13 files changed

+11893
-16102
lines changed

.eslintrc.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
module.exports = {
2-
"extends": "airbnb-base",
3-
"env": {
4-
node: true,
5-
mocha: true
6-
},
7-
"rules": {
8-
"max-len": "off",
9-
"func-names": "off",
10-
"no-useless-escape": "off",
11-
"global-require": "off",
12-
"import/no-dynamic-require": "off",
13-
"consistent-return": "off",
14-
"prefer-destructuring": "off",
15-
"camelcase": "off",
16-
"comma-dangle": ["error", "never"]
17-
}
2+
extends: 'airbnb-base',
3+
env: {
4+
node: true,
5+
mocha: true
6+
},
7+
rules: {
8+
'max-len': 'off',
9+
'func-names': 'off',
10+
'no-useless-escape': 'off',
11+
'global-require': 'off',
12+
'import/no-dynamic-require': 'off',
13+
'consistent-return': 'off',
14+
'prefer-destructuring': 'off',
15+
camelcase: 'off',
16+
'comma-dangle': ['error', 'never']
17+
}
1818
};

helpers/delay.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module.exports = duration => (req, res, next) => {
1+
module.exports = (duration) => (req, res, next) => {
22
setTimeout(next, duration);
33
};

helpers/end.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module.exports = message => (req, res) => {
1+
module.exports = (message) => (req, res) => {
22
res.end(message);
33
};

helpers/file.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const fs = require('fs');
22

3-
module.exports = filePath => (req, res) => {
3+
module.exports = (filePath) => (req, res) => {
44
const stat = fs.statSync(filePath);
55

66
res.setHeader('Content-Length', stat.size);

helpers/json.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = data => (req, res) => {
1+
module.exports = (data) => (req, res) => {
22
let responseData = data;
33
if (typeof data === 'function') {
44
responseData = data(req, res);

helpers/not-found.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
const status = require('./status');
22
const end = require('./end');
33

4-
module.exports = message => [status(404), end(message)];
4+
module.exports = (message) => [status(404), end(message)];

helpers/status.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = status => (req, res, next) => {
1+
module.exports = (status) => (req, res, next) => {
22
res.statusCode = status;
33
next();
44
};

helpers/type.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = type => (req, res, next) => {
1+
module.exports = (type) => (req, res, next) => {
22
res.setHeader('Content-Type', type);
33
next();
44
};

index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ function findMatchingFolderOnLevel(parentPath, testPath, existingParams) {
4747
});
4848
}
4949
fs.readdirSync(parentPath)
50-
.filter(file => fs.lstatSync(path.join(parentPath, file)).isDirectory())
51-
.filter(folder_name => folder_name.slice(0, 2) === '__' && folder_name.slice(-2) === '__')
52-
.map(wildcardFolder => ({
50+
.filter((file) => fs.lstatSync(path.join(parentPath, file)).isDirectory())
51+
.filter((folder_name) => folder_name.slice(0, 2) === '__' && folder_name.slice(-2) === '__')
52+
.map((wildcardFolder) => ({
5353
param: wildcardFolder.slice(2, -2),
5454
folder: wildcardFolder
5555
}))
@@ -89,7 +89,7 @@ function findMatchingPath(requestPath, requestMethodFiles) {
8989
const pathOptions = recurseLookup([pathParts.shift()], pathParts, []);
9090

9191
let result = false;
92-
pathOptions.some(pathOption => requestMethodFiles.some((requestMethodFile) => {
92+
pathOptions.some((pathOption) => requestMethodFiles.some((requestMethodFile) => {
9393
if (fs.existsSync(path.join(pathOption.path, requestMethodFile))) {
9494
result = {
9595
path: path.resolve(path.join(pathOption.path, requestMethodFile)),
@@ -182,7 +182,9 @@ module.exports = function (urlRoot, pathRoot) {
182182
customMiddleware = [].concat(...customMiddleware);
183183

184184
customMiddleware.reduce((chain, middleware) => chain.then(
185-
() => new Promise(resolve => middleware(request, response, resolve))
185+
() => new Promise((resolve) => {
186+
middleware(request, response, resolve);
187+
})
186188
), Promise.resolve()).then(next);
187189
};
188190

@@ -222,7 +224,7 @@ module.exports = function (urlRoot, pathRoot) {
222224

223225
const methodFiles = [jsMockFile, staticMockFile, wildcardJsMockFile, wildcardStaticMockFile];
224226

225-
const matchedMethodFile = methodFiles.find(methodFile => fs.existsSync(path.join(targetFullPath, methodFile)));
227+
const matchedMethodFile = methodFiles.find((methodFile) => fs.existsSync(path.join(targetFullPath, methodFile)));
226228

227229
if (matchedMethodFile) {
228230
return returnForPath(path.resolve(path.join(targetFullPath, matchedMethodFile)));

0 commit comments

Comments
 (0)