diff --git a/lib/classes/Error.js b/lib/classes/Error.js index 4beec093a72..a31cefe650b 100644 --- a/lib/classes/Error.js +++ b/lib/classes/Error.js @@ -85,8 +85,7 @@ module.exports.logError = e => { process.exit(1); } // report error to sentry. - errorReporter.captureException(e, (sendErr, eventId) => { - // eslint-disable-line + errorReporter.captureException(e, () => { // process.exit(1) for CI systems to correctly fail process.exit(1); }); diff --git a/lib/classes/Service.js b/lib/classes/Service.js index 4ba46d0ce10..0dbf9c2a8cb 100644 --- a/lib/classes/Service.js +++ b/lib/classes/Service.js @@ -174,7 +174,7 @@ class Service { _.forEach(this.functions, (functionObj, functionName) => { if (!_.isArray(functionObj.events)) { throw new ServerlessError( - `Events for "${functionName}" must be an array,` + ` not an ${typeof functionObj.events}` + `Events for "${functionName}" must be an array, not an ${typeof functionObj.events}` ); } }); diff --git a/lib/classes/Variables.js b/lib/classes/Variables.js index 30b685f9ae1..64c377a9a9e 100644 --- a/lib/classes/Variables.js +++ b/lib/classes/Variables.js @@ -488,7 +488,7 @@ class Variables { // A sentinel to rid rejected Promises, so any of resolved value can be used as fallback. const FAIL_TOKEN = {}; const variableValues = variableStrings.map(variableString => - this.getValueFromSource(variableString, propertyString).catch(unused => FAIL_TOKEN) + this.getValueFromSource(variableString, propertyString).catch(() => FAIL_TOKEN) ); // eslint-disable-line no-unused-vars const validValue = value => diff --git a/lib/plugins/aws/package/compile/functions/index.js b/lib/plugins/aws/package/compile/functions/index.js index b7d09106ddc..5ab76c41d45 100644 --- a/lib/plugins/aws/package/compile/functions/index.js +++ b/lib/plugins/aws/package/compile/functions/index.js @@ -334,7 +334,6 @@ class AwsCompileFunctions { let invalidEnvVar = null; _.forEach(_.keys(newFunction.Properties.Environment.Variables), key => { - // eslint-disable-line consistent-return // taken from the bash man pages if (!key.match(/^[A-Za-z_][a-zA-Z0-9_]*$/)) { invalidEnvVar = `Invalid characters in environment variable ${key}`; @@ -349,6 +348,7 @@ class AwsCompileFunctions { return false; } } + return true; }); if (invalidEnvVar) { diff --git a/lib/plugins/aws/package/compile/functions/index.test.js b/lib/plugins/aws/package/compile/functions/index.test.js index 62e50d46200..237962404c4 100644 --- a/lib/plugins/aws/package/compile/functions/index.test.js +++ b/lib/plugins/aws/package/compile/functions/index.test.js @@ -1921,46 +1921,43 @@ describe('AwsCompileFunctions', () => { }); }); - it( - 'should consider the providers runtime and memorySize ' + 'when creating a function resource', - () => { - const s3Folder = awsCompileFunctions.serverless.service.package.artifactDirectoryName; - const s3FileName = awsCompileFunctions.serverless.service.package.artifact - .split(path.sep) - .pop(); - awsCompileFunctions.serverless.service.provider.runtime = 'python2.7'; - awsCompileFunctions.serverless.service.provider.memorySize = 128; - awsCompileFunctions.serverless.service.functions = { - func: { - handler: 'func.function.handler', - name: 'new-service-dev-func', - }, - }; - const compiledFunction = { - Type: 'AWS::Lambda::Function', - DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'], - Properties: { - Code: { - S3Key: `${s3Folder}/${s3FileName}`, - S3Bucket: { Ref: 'ServerlessDeploymentBucket' }, - }, - FunctionName: 'new-service-dev-func', - Handler: 'func.function.handler', - MemorySize: 128, - Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'python2.7', - Timeout: 6, + it('should consider the providers runtime and memorySize when creating a function resource', () => { + const s3Folder = awsCompileFunctions.serverless.service.package.artifactDirectoryName; + const s3FileName = awsCompileFunctions.serverless.service.package.artifact + .split(path.sep) + .pop(); + awsCompileFunctions.serverless.service.provider.runtime = 'python2.7'; + awsCompileFunctions.serverless.service.provider.memorySize = 128; + awsCompileFunctions.serverless.service.functions = { + func: { + handler: 'func.function.handler', + name: 'new-service-dev-func', + }, + }; + const compiledFunction = { + Type: 'AWS::Lambda::Function', + DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'], + Properties: { + Code: { + S3Key: `${s3Folder}/${s3FileName}`, + S3Bucket: { Ref: 'ServerlessDeploymentBucket' }, }, - }; + FunctionName: 'new-service-dev-func', + Handler: 'func.function.handler', + MemorySize: 128, + Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, + Runtime: 'python2.7', + Timeout: 6, + }, + }; - return expect(awsCompileFunctions.compileFunctions()).to.be.fulfilled.then(() => { - expect( - awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate.Resources - .FuncLambdaFunction - ).to.deep.equal(compiledFunction); - }); - } - ); + return expect(awsCompileFunctions.compileFunctions()).to.be.fulfilled.then(() => { + expect( + awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate.Resources + .FuncLambdaFunction + ).to.deep.equal(compiledFunction); + }); + }); it('should use a custom bucket if specified', () => { const s3Folder = awsCompileFunctions.serverless.service.package.artifactDirectoryName; diff --git a/lib/utils/yamlAstParser.test.js b/lib/utils/yamlAstParser.test.js index 510b2ad53ac..641c859c8a1 100644 --- a/lib/utils/yamlAstParser.test.js +++ b/lib/utils/yamlAstParser.test.js @@ -309,7 +309,7 @@ describe('#yamlAstParser', () => { }); it('should remove when with inline declaration of the array', () => { - const yamlContent = 'toplevel:\n' + ' second: ["foo2", "bar"]'; + const yamlContent = 'toplevel:\n second: ["foo2", "bar"]'; const expectedResult = { toplevel: { second: ['foo2'],