Skip to content

Commit 2d51bc0

Browse files
authored
Merge pull request #232 from horike37/dependabot/npm_and_yarn/eslint-4.18.2
build(deps-dev): bump eslint from 3.19.0 to 4.18.2
2 parents 0c790a8 + 9d820f4 commit 2d51bc0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2699
-2163
lines changed

.eslintrc.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ module.exports = {
33
"plugins": [],
44
"rules": {
55
"func-names": "off",
6-
7-
// doesn't work in node v4 :(
6+
"prefer-destructuring": "off",
7+
"no-plusplus": "off",
8+
"no-template-curly-in-string": "off",
9+
"no-restricted-syntax": "off",
810
"strict": "off",
911
"prefer-rest-params": "off",
1012
"react/require-extension" : "off",
@@ -13,4 +15,4 @@ module.exports = {
1315
"env": {
1416
"mocha": true
1517
}
16-
};
18+
};

lib/deploy/events/apiGateway/apiKeys.test.js

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -30,51 +30,49 @@ describe('#methods()', () => {
3030
serverlessStepFunctions.apiGatewayDeploymentLogicalId = 'ApiGatewayDeploymentTest';
3131
});
3232

33-
it('should compile api key resource', () =>
34-
serverlessStepFunctions.compileApiKeys().then(() => {
35-
expect(
36-
serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate
37-
.Resources[
38-
serverlessStepFunctions.provider.naming.getApiKeyLogicalId(1)
39-
].Type
40-
).to.equal('AWS::ApiGateway::ApiKey');
33+
it('should compile api key resource', () => serverlessStepFunctions.compileApiKeys().then(() => {
34+
expect(
35+
serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate
36+
.Resources[
37+
serverlessStepFunctions.provider.naming.getApiKeyLogicalId(1)
38+
].Type,
39+
).to.equal('AWS::ApiGateway::ApiKey');
4140

42-
expect(
43-
serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate
44-
.Resources[
45-
serverlessStepFunctions.provider.naming.getApiKeyLogicalId(1)
46-
].Properties.Enabled
47-
).to.equal(true);
41+
expect(
42+
serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate
43+
.Resources[
44+
serverlessStepFunctions.provider.naming.getApiKeyLogicalId(1)
45+
].Properties.Enabled,
46+
).to.equal(true);
4847

49-
expect(
50-
serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate
51-
.Resources[
52-
serverlessStepFunctions.provider.naming.getApiKeyLogicalId(1)
53-
].Properties.Name
54-
).to.equal('1234567890');
48+
expect(
49+
serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate
50+
.Resources[
51+
serverlessStepFunctions.provider.naming.getApiKeyLogicalId(1)
52+
].Properties.Name,
53+
).to.equal('1234567890');
5554

56-
expect(
57-
serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate
58-
.Resources[
59-
serverlessStepFunctions.provider.naming.getApiKeyLogicalId(1)
60-
].Properties.StageKeys[0].RestApiId.Ref
61-
).to.equal('ApiGatewayRestApi');
55+
expect(
56+
serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate
57+
.Resources[
58+
serverlessStepFunctions.provider.naming.getApiKeyLogicalId(1)
59+
].Properties.StageKeys[0].RestApiId.Ref,
60+
).to.equal('ApiGatewayRestApi');
6261

63-
expect(
64-
serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate
65-
.Resources[
66-
serverlessStepFunctions.provider.naming.getApiKeyLogicalId(1)
67-
].Properties.StageKeys[0].StageName
68-
).to.equal('dev');
62+
expect(
63+
serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate
64+
.Resources[
65+
serverlessStepFunctions.provider.naming.getApiKeyLogicalId(1)
66+
].Properties.StageKeys[0].StageName,
67+
).to.equal('dev');
6968

70-
expect(
71-
serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate
72-
.Resources[
73-
serverlessStepFunctions.provider.naming.getApiKeyLogicalId(1)
74-
].DependsOn
75-
).to.equal('ApiGatewayDeploymentTest');
76-
})
77-
);
69+
expect(
70+
serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate
71+
.Resources[
72+
serverlessStepFunctions.provider.naming.getApiKeyLogicalId(1)
73+
].DependsOn,
74+
).to.equal('ApiGatewayDeploymentTest');
75+
}));
7876

7977
it('throw error if apiKey property is not an array', () => {
8078
serverlessStepFunctions.serverless.service.provider.apiKeys = 2;

lib/deploy/events/apiGateway/cors.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ module.exports = {
3636
}
3737

3838
if (_.includes(config.methods, 'ANY')) {
39-
preflightHeaders['Access-Control-Allow-Methods'] =
40-
preflightHeaders['Access-Control-Allow-Methods']
41-
.replace('ANY', 'DELETE,GET,HEAD,PATCH,POST,PUT');
39+
preflightHeaders['Access-Control-Allow-Methods'] = preflightHeaders['Access-Control-Allow-Methods']
40+
.replace('ANY', 'DELETE,GET,HEAD,PATCH,POST,PUT');
4241
}
4342

4443
_.merge(this.serverless.service.provider.compiledCloudFormationTemplate.Resources, {

lib/deploy/events/apiGateway/cors.test.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -96,129 +96,129 @@ describe('#compileCors()', () => {
9696
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
9797
.Resources.ApiGatewayMethodUsersCreateOptions
9898
.Properties.Integration.IntegrationResponses[0]
99-
.ResponseParameters['method.response.header.Access-Control-Allow-Origin']
99+
.ResponseParameters['method.response.header.Access-Control-Allow-Origin'],
100100
).to.equal('\'*,http://example.com\'');
101101

102102
expect(
103103
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
104104
.Resources.ApiGatewayMethodUsersCreateOptions
105105
.Properties.Integration.IntegrationResponses[0]
106-
.ResponseParameters['method.response.header.Access-Control-Allow-Headers']
106+
.ResponseParameters['method.response.header.Access-Control-Allow-Headers'],
107107
).to.equal('\'*\'');
108108

109109
expect(
110110
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
111111
.Resources.ApiGatewayMethodUsersCreateOptions
112112
.Properties.Integration.IntegrationResponses[0]
113-
.ResponseParameters['method.response.header.Access-Control-Allow-Methods']
113+
.ResponseParameters['method.response.header.Access-Control-Allow-Methods'],
114114
).to.equal('\'OPTIONS,POST\'');
115115

116116
expect(
117117
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
118118
.Resources.ApiGatewayMethodUsersCreateOptions
119119
.Properties.Integration.IntegrationResponses[0]
120-
.ResponseParameters['method.response.header.Access-Control-Allow-Credentials']
120+
.ResponseParameters['method.response.header.Access-Control-Allow-Credentials'],
121121
).to.equal('\'true\'');
122122

123123
expect(
124124
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
125125
.Resources.ApiGatewayMethodUsersCreateOptions
126126
.Properties.Integration.IntegrationResponses[0]
127-
.ResponseParameters['method.response.header.Access-Control-Max-Age']
127+
.ResponseParameters['method.response.header.Access-Control-Max-Age'],
128128
).to.equal('\'86400\'');
129129

130130
// users/update
131131
expect(
132132
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
133133
.Resources.ApiGatewayMethodUsersUpdateOptions
134134
.Properties.Integration.IntegrationResponses[0]
135-
.ResponseParameters['method.response.header.Access-Control-Allow-Origin']
135+
.ResponseParameters['method.response.header.Access-Control-Allow-Origin'],
136136
).to.equal('\'http://example.com\'');
137137

138138
expect(
139139
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
140140
.Resources.ApiGatewayMethodUsersUpdateOptions
141141
.Properties.Integration.IntegrationResponses[0]
142-
.ResponseParameters['method.response.header.Access-Control-Allow-Methods']
142+
.ResponseParameters['method.response.header.Access-Control-Allow-Methods'],
143143
).to.equal('\'OPTIONS,PUT\'');
144144

145145
expect(
146146
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
147147
.Resources.ApiGatewayMethodUsersUpdateOptions
148148
.Properties.Integration.IntegrationResponses[0]
149-
.ResponseParameters['method.response.header.Access-Control-Allow-Credentials']
149+
.ResponseParameters['method.response.header.Access-Control-Allow-Credentials'],
150150
).to.equal('\'false\'');
151151

152152
expect(
153153
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
154154
.Resources.ApiGatewayMethodUsersUpdateOptions
155155
.Properties.Integration.IntegrationResponses[0]
156-
.ResponseParameters['method.response.header.Access-Control-Max-Age']
156+
.ResponseParameters['method.response.header.Access-Control-Max-Age'],
157157
).to.equal('\'86400\'');
158158

159159
// users/delete
160160
expect(
161161
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
162162
.Resources.ApiGatewayMethodUsersDeleteOptions
163163
.Properties.Integration.IntegrationResponses[0]
164-
.ResponseParameters['method.response.header.Access-Control-Allow-Origin']
164+
.ResponseParameters['method.response.header.Access-Control-Allow-Origin'],
165165
).to.equal('\'*\'');
166166

167167
expect(
168168
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
169169
.Resources.ApiGatewayMethodUsersDeleteOptions
170170
.Properties.Integration.IntegrationResponses[0]
171-
.ResponseParameters['method.response.header.Access-Control-Allow-Headers']
171+
.ResponseParameters['method.response.header.Access-Control-Allow-Headers'],
172172
).to.equal('\'CustomHeaderA,CustomHeaderB\'');
173173

174174
expect(
175175
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
176176
.Resources.ApiGatewayMethodUsersDeleteOptions
177177
.Properties.Integration.IntegrationResponses[0]
178-
.ResponseParameters['method.response.header.Access-Control-Allow-Methods']
178+
.ResponseParameters['method.response.header.Access-Control-Allow-Methods'],
179179
).to.equal('\'OPTIONS,DELETE\'');
180180

181181
expect(
182182
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
183183
.Resources.ApiGatewayMethodUsersDeleteOptions
184184
.Properties.Integration.IntegrationResponses[0]
185-
.ResponseParameters['method.response.header.Access-Control-Allow-Credentials']
185+
.ResponseParameters['method.response.header.Access-Control-Allow-Credentials'],
186186
).to.equal('\'false\'');
187187

188188
expect(
189189
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
190190
.Resources.ApiGatewayMethodUsersDeleteOptions
191191
.Properties.Integration.IntegrationResponses[0]
192-
.ResponseParameters['method.response.header.Access-Control-Max-Age']
192+
.ResponseParameters['method.response.header.Access-Control-Max-Age'],
193193
).to.equal('\'86400\'');
194194

195195
// users/any
196196
expect(
197197
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
198198
.Resources.ApiGatewayMethodUsersAnyOptions
199199
.Properties.Integration.IntegrationResponses[0]
200-
.ResponseParameters['method.response.header.Access-Control-Allow-Origin']
200+
.ResponseParameters['method.response.header.Access-Control-Allow-Origin'],
201201
).to.equal('\'http://example.com\'');
202202

203203
expect(
204204
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
205205
.Resources.ApiGatewayMethodUsersAnyOptions
206206
.Properties.Integration.IntegrationResponses[0]
207-
.ResponseParameters['method.response.header.Access-Control-Allow-Headers']
207+
.ResponseParameters['method.response.header.Access-Control-Allow-Headers'],
208208
).to.equal('\'*\'');
209209

210210
expect(
211211
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
212212
.Resources.ApiGatewayMethodUsersAnyOptions
213213
.Properties.Integration.IntegrationResponses[0]
214-
.ResponseParameters['method.response.header.Access-Control-Allow-Methods']
214+
.ResponseParameters['method.response.header.Access-Control-Allow-Methods'],
215215
).to.equal('\'OPTIONS,DELETE,GET,HEAD,PATCH,POST,PUT\'');
216216

217217
expect(
218218
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
219219
.Resources.ApiGatewayMethodUsersAnyOptions
220220
.Properties.Integration.IntegrationResponses[0]
221-
.ResponseParameters['method.response.header.Access-Control-Allow-Credentials']
221+
.ResponseParameters['method.response.header.Access-Control-Allow-Credentials'],
222222
).to.equal('\'false\'');
223223
});
224224
});

lib/deploy/events/apiGateway/deployment.test.js

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ describe('#compileDeployment()', () => {
2222
};
2323
serverlessStepFunctions = new ServerlessStepFunctions(serverless, options);
2424
serverlessStepFunctions.apiGatewayRestApiLogicalId = 'ApiGatewayRestApi';
25-
serverlessStepFunctions.apiGatewayMethodLogicalIds
26-
= ['method-dependency1', 'method-dependency2'];
25+
serverlessStepFunctions.apiGatewayMethodLogicalIds = ['method-dependency1', 'method-dependency2'];
2726
});
2827

2928
it('should create a deployment resource', () => serverlessStepFunctions
@@ -34,7 +33,7 @@ describe('#compileDeployment()', () => {
3433

3534
expect(
3635
serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate
37-
.Resources[apiGatewayDeploymentLogicalId]
36+
.Resources[apiGatewayDeploymentLogicalId],
3837
).to.deep.equal({
3938
Type: 'AWS::ApiGateway::Deployment',
4039
DependsOn: ['method-dependency1', 'method-dependency2'],
@@ -43,31 +42,28 @@ describe('#compileDeployment()', () => {
4342
StageName: 'dev',
4443
},
4544
});
46-
})
47-
);
45+
}));
4846

49-
it('should add service endpoint output', () =>
50-
serverlessStepFunctions.compileDeployment().then(() => {
51-
expect(
52-
serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate
53-
.Outputs.ServiceEndpoint
54-
).to.deep.equal({
55-
Description: 'URL of the service endpoint',
56-
Value: {
57-
'Fn::Join': [
58-
'',
59-
[
60-
'https://',
61-
{ Ref: serverlessStepFunctions.apiGatewayRestApiLogicalId },
62-
'.execute-api.',
63-
{ Ref: 'AWS::Region' },
64-
'.',
65-
{ Ref: 'AWS::URLSuffix' },
66-
'/dev',
67-
],
47+
it('should add service endpoint output', () => serverlessStepFunctions.compileDeployment().then(() => {
48+
expect(
49+
serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate
50+
.Outputs.ServiceEndpoint,
51+
).to.deep.equal({
52+
Description: 'URL of the service endpoint',
53+
Value: {
54+
'Fn::Join': [
55+
'',
56+
[
57+
'https://',
58+
{ Ref: serverlessStepFunctions.apiGatewayRestApiLogicalId },
59+
'.execute-api.',
60+
{ Ref: 'AWS::Region' },
61+
'.',
62+
{ Ref: 'AWS::URLSuffix' },
63+
'/dev',
6864
],
69-
},
70-
});
71-
})
72-
);
65+
],
66+
},
67+
});
68+
}));
7369
});

lib/deploy/events/apiGateway/endpointInfo.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ module.exports = {
1212
{ StackName: stackName },
1313
this.options.stage,
1414
this.options.region)
15-
.then((result) => {
16-
if (result) {
17-
const serviceEndpointOutputRegex = this.provider.naming
18-
.getServiceEndpointRegex();
15+
.then((result) => {
16+
if (result) {
17+
const serviceEndpointOutputRegex = this.provider.naming
18+
.getServiceEndpointRegex();
1919

20-
// Endpoints
21-
result.Stacks[0].Outputs.filter(x => x.OutputKey.match(serviceEndpointOutputRegex))
22-
.forEach(x => {
23-
this.endpointInfo = x.OutputValue;
24-
});
25-
}
20+
// Endpoints
21+
result.Stacks[0].Outputs.filter(x => x.OutputKey.match(serviceEndpointOutputRegex))
22+
.forEach((x) => {
23+
this.endpointInfo = x.OutputValue;
24+
});
25+
}
2626

27-
return BbPromise.resolve();
28-
});
27+
return BbPromise.resolve();
28+
});
2929
},
3030
};

0 commit comments

Comments
 (0)