style: fix linting

This commit is contained in:
virkt25 2018-08-23 22:09:45 -04:00
parent 7b4cf0b236
commit 47002dceff
3 changed files with 16 additions and 9 deletions

1
.npmrc Normal file
View File

@ -0,0 +1 @@
package-lock=false

View File

@ -52,9 +52,11 @@ exports.upload = function(provider, req, res, options, cb) {
self._fieldsSize += buffer.length; self._fieldsSize += buffer.length;
if (self._fieldsSize > self.maxFieldsSize) { if (self._fieldsSize > self.maxFieldsSize) {
self._error(new Error( self._error(new Error(
g.f('{{maxFieldsSize}} exceeded, received %s bytes of field data', g.f(
'{{maxFieldsSize}} exceeded, received %s bytes of field data',
self._fieldsSize self._fieldsSize
))); )
));
return; return;
} }
value += decoder.write(buffer); value += decoder.write(buffer);
@ -104,10 +106,12 @@ exports.upload = function(provider, req, res, options, cb) {
if (Array.isArray(allowedContentTypes) && allowedContentTypes.length !== 0) { if (Array.isArray(allowedContentTypes) && allowedContentTypes.length !== 0) {
if (allowedContentTypes.indexOf(file.type) === -1) { if (allowedContentTypes.indexOf(file.type) === -1) {
self._error(new Error( self._error(new Error(
g.f('{{contentType}} "%s" is not allowed (Must be in [%s])', g.f(
'{{contentType}} "%s" is not allowed (Must be in [%s])',
file.type, file.type,
allowedContentTypes.join(', ') allowedContentTypes.join(', ')
))); )
));
return; return;
} }
} }
@ -203,10 +207,12 @@ exports.upload = function(provider, req, res, options, cb) {
// - s3-upload-stream doesn't provide a way to do this in it's public interface // - s3-upload-stream doesn't provide a way to do this in it's public interface
// - We could call provider.delete file but it would not delete multipart data // - We could call provider.delete file but it would not delete multipart data
self._error(new Error( self._error(new Error(
g.f('{{maxFileSize}} exceeded, received %s bytes of field data (max is %s)', g.f(
'{{maxFileSize}} exceeded, received %s bytes of field data (max is %s)',
fileSize, fileSize,
maxFileSize maxFileSize
))); )
));
return; return;
} }
}); });

View File

@ -20,10 +20,10 @@
"uuid": "^3.2.1" "uuid": "^3.2.1"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^4.19.1", "eslint": "^5.4.0",
"eslint-config-loopback": "^10.0.0", "eslint-config-loopback": "^11.0.0",
"express": "^4.16.3", "express": "^4.16.3",
"loopback": "^3.20.0", "loopback": "^3.22.1",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"mocha": "^5.2.0", "mocha": "^5.2.0",
"supertest": "^3.1.0", "supertest": "^3.1.0",