Skip to content

Commit cb1604c

Browse files
jstewmonAllanZhengYP
authored andcommitted
fix: update eslint, enforce semi, apply to test dir (#2336)
1 parent fd8fc03 commit cb1604c

File tree

135 files changed

+1608
-1599
lines changed

Some content is hidden

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

135 files changed

+1608
-1599
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/*
2+
test/browser/**/*

.eslintrc

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
"rules": {
1111
"quotes": [2, "single"],
1212
"strict": 0,
13+
"eol-last": ["error", "always"],
1314
"curly": 0,
1415
"no-empty": 0,
1516
"no-underscore-dangle": 0,
1617
"new-cap": 0,
1718
"dot-notation": 0,
1819
"no-use-before-define": 0,
19-
"space-after-keywords": [2, "always"],
20+
"semi": [2, "always"],
21+
"keyword-spacing": [2, {"before": true, "after": true}],
2022
"space-before-blocks": [2, "always"],
2123
"no-trailing-spaces": 2,
2224
"space-unary-ops": 0

dist-tools/client-creator.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ ClientCreator.prototype.generateClientFileSource = function generateClientFileSo
105105
}
106106
code += 'Object.defineProperty(apiLoader.services[\'' + serviceName +'\'], \'' + version + '\', {\n';
107107
code += tab + 'get: function get() {\n';
108-
code += tab + tab + 'var model = require(\'../apis/' + versionInfo.api + '.json\');\n'
108+
code += tab + tab + 'var model = require(\'../apis/' + versionInfo.api + '.json\');\n';
109109
if (versionInfo.hasOwnProperty('paginators')) {
110110
code += tab + tab + 'model.paginators = require(\'../apis/' + versionInfo.paginators + '.json\').pagination;\n';
111111
}
@@ -125,7 +125,7 @@ ClientCreator.prototype.generateClientFileSource = function generateClientFileSo
125125
code: code,
126126
path: path.join(clientFolderPath, serviceName + '.js'),
127127
service: serviceName,
128-
}
128+
};
129129
};
130130

131131
ClientCreator.prototype.tabs = function tabs(count) {
@@ -134,7 +134,7 @@ ClientCreator.prototype.tabs = function tabs(count) {
134134
tab += ' ';
135135
}
136136
return tab;
137-
}
137+
};
138138

139139
ClientCreator.prototype.generateDefinePropertySource = function generateDefinePropertySource(objName, serviceName, className) {
140140
var tabs = this.tabs;
@@ -211,4 +211,4 @@ ClientCreator.prototype.writeClientServices = function writeClientServices() {
211211
fs.writeFileSync(browserClientInfo.path, browserClientInfo.code);
212212
};
213213

214-
module.exports = ClientCreator;
214+
module.exports = ClientCreator;

dist-tools/create-all-services.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ var ClientCreator = require('./client-creator');
33
var cc = new ClientCreator();
44

55
cc.writeClientServices();
6-
console.log('Finished updating services.');
6+
console.log('Finished updating services.');

dist-tools/service-collector.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,4 @@ function ServiceCollector(services) {
165165
return serviceCode;
166166
}
167167

168-
module.exports = ServiceCollector;
168+
module.exports = ServiceCollector;

dist-tools/webpack.config.rn-core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ module.exports = {
2929
}
3030
]
3131
}
32-
}
32+
};

dist-tools/webpack.config.rn-dep.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ module.exports = {
2828
}
2929
]
3030
}
31-
}
31+
};

dist-tools/webpack.config.rn.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ module.exports = {
3131
}
3232
]
3333
}
34-
}
34+
};

lib/browser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ if (typeof self !== 'undefined') self.AWS = AWS;
1616
* DO NOT REMOVE
1717
* browser builder will strip out this line if services are supplied on the command line.
1818
*/
19-
require('../clients/browser_default');
19+
require('../clients/browser_default');

lib/browserCryptoLib.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ module.exports = exports = {
3434
createSign: function() {
3535
throw new Error('createSign is not implemented in the browser');
3636
}
37-
}
37+
};

lib/browserHashUtils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ function convertToBuffer(data) {
6262
module.exports = exports = {
6363
isEmptyData: isEmptyData,
6464
convertToBuffer: convertToBuffer,
65-
}
65+
};

lib/browserHmac.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Hmac.prototype.digest = function (encoding) {
5050
}
5151

5252
return this.outer.digest(encoding);
53-
}
53+
};
5454

5555
function bufferFromSecret(hashCtor, secret) {
5656
var input = hashUtils.convertToBuffer(secret);

lib/browserSha1.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,4 @@ Sha1.prototype.processBlock = function processBlock() {
163163
for (i = 0; i < 16; i++) {
164164
this.block[i] = 0;
165165
}
166-
}
166+
};

lib/cloudfront/signer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var queryEncode = function (string) {
1818
var signPolicy = function (policy, privateKey) {
1919
var sign = crypto.createSign('RSA-SHA1');
2020
sign.write(policy);
21-
return queryEncode(sign.sign(privateKey, 'base64'))
21+
return queryEncode(sign.sign(privateKey, 'base64'));
2222
};
2323

2424
var signWithCannedPolicy = function (url, expires, keyPairId, privateKey) {
@@ -45,7 +45,7 @@ var signWithCustomPolicy = function (policy, keyPairId, privateKey) {
4545
Policy: queryEncode(base64Encode(policy)),
4646
'Key-Pair-Id': keyPairId,
4747
Signature: signPolicy(policy, privateKey)
48-
}
48+
};
4949
};
5050

5151
var determineScheme = function (url) {

lib/credentials/chainable_temporary_credentials.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ AWS.ChainableTemporaryCredentials = AWS.util.inherit(AWS.Credentials, {
105105
this.expired = true;
106106
this.tokenCodeFn = null;
107107

108-
var params = AWS.util.copy(options.params) || {}
108+
var params = AWS.util.copy(options.params) || {};
109109
if (params.RoleArn) {
110110
params.RoleSessionName = params.RoleSessionName || 'temporary-credentials';
111111
}

lib/discover_endpoint.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ function getCacheKey(request) {
2020
identifiers.region = service.config.region;
2121
}
2222
if (api.serviceId) {
23-
identifiers.serviceId = api.serviceId
23+
identifiers.serviceId = api.serviceId;
2424
}
2525
if (service.config.credentials.accessKeyId) {
26-
identifiers.accessKeyId = service.config.credentials.accessKeyId
26+
identifiers.accessKeyId = service.config.credentials.accessKeyId;
2727
}
2828
return identifiers;
2929
}
@@ -356,4 +356,4 @@ module.exports = {
356356
marshallCustomIdentifiers: marshallCustomIdentifiers,
357357
getCacheKey: getCacheKey,
358358
invalidateCachedEndpoint: invalidateCachedEndpoints,
359-
}
359+
};

lib/dynamodb/numberValue.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ var DynamoDBNumberValue = util.inherit({
4040
/**
4141
* @api private
4242
*/
43-
module.exports = DynamoDBNumberValue;
43+
module.exports = DynamoDBNumberValue;

lib/empty.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
/**
44
* @api private
55
*/
6-
module.exports = {};
6+
module.exports = {};

lib/event-stream/alloc-buffer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ function allocBuffer(size) {
1818
*/
1919
module.exports = {
2020
allocBuffer: allocBuffer
21-
};
21+
};

lib/event-stream/buffered-create-event-stream.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ function createEventStream(body, parser, model) {
1818
*/
1919
module.exports = {
2020
createEventStream: createEventStream
21-
};
21+
};

lib/event-stream/build-message.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,4 @@ var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12
171171
*/
172172
module.exports = {
173173
buildMessage: buildMessage
174-
};
174+
};

lib/event-stream/event-message-chunker-stream.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ EventMessageChunkerStream.prototype._flush = function(callback) {
9696
} else {
9797
callback();
9898
}
99-
}
99+
};
100100

101101
/**
102102
* @param {number} size Size of the message to be allocated.
@@ -117,4 +117,4 @@ EventMessageChunkerStream.prototype.allocateMessage = function(size) {
117117
*/
118118
module.exports = {
119119
EventMessageChunkerStream: EventMessageChunkerStream
120-
};
120+
};

lib/event-stream/event-message-chunker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ function eventMessageChunker(buffer) {
2727
*/
2828
module.exports = {
2929
eventMessageChunker: eventMessageChunker
30-
};
30+
};

lib/event-stream/event-message-unmarshaller-stream.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ EventUnmarshallerStream.prototype._transform = function(chunk, encoding, callbac
3636
*/
3737
module.exports = {
3838
EventUnmarshallerStream: EventUnmarshallerStream
39-
};
39+
};

lib/event-stream/int64.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Int64.fromNumber = function(number) {
3333
);
3434
}
3535

36-
var bytes = new Uint8Array(8)
36+
var bytes = new Uint8Array(8);
3737
for (
3838
var i = 7, remaining = Math.abs(Math.round(number));
3939
i > -1 && remaining > 0;
@@ -90,4 +90,4 @@ function negate(bytes) {
9090
*/
9191
module.exports = {
9292
Int64: Int64
93-
};
93+
};

lib/event-stream/parse-event.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ function parseError(message) {
7070
*/
7171
module.exports = {
7272
parseEvent: parseEvent
73-
};
73+
};

lib/event-stream/parse-message.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,4 @@ function parseMessage(message) {
125125
*/
126126
module.exports = {
127127
parseMessage: parseMessage
128-
};
128+
};

lib/event-stream/split-message.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ function splitMessage(message) {
6767
*/
6868
module.exports = {
6969
splitMessage: splitMessage
70-
};
70+
};

lib/event-stream/streaming-create-event-stream.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ function createEventStream(stream, parser, model) {
3636
*/
3737
module.exports = {
3838
createEventStream: createEventStream
39-
};
39+
};

lib/event-stream/to-buffer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ function toBuffer(data, encoding) {
1515
*/
1616
module.exports = {
1717
toBuffer: toBuffer
18-
};
18+
};

lib/event_listeners.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -512,23 +512,23 @@ AWS.EventListeners = {
512512
} else {
513513
struct[subShapeName] = subShape;
514514
}
515-
})
516-
return struct
515+
});
516+
return struct;
517517
case 'list':
518518
var list = [];
519519
AWS.util.arrayEach(shape, function(subShape, index) {
520520
list.push(filterSensitiveLog(inputShape.member, subShape));
521-
})
521+
});
522522
return list;
523523
case 'map':
524524
var map = {};
525525
AWS.util.each(shape, function(key, value) {
526526
map[key] = filterSensitiveLog(inputShape.value, value);
527-
})
527+
});
528528
return map;
529529
default:
530530
if (inputShape.isSensitive) {
531-
return '***SensitiveInformation***'
531+
return '***SensitiveInformation***';
532532
} else {
533533
return shape;
534534
}

lib/http.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ AWS.HttpRequest = inherit({
160160
updateEndpoint: function updateEndpoint(endpointStr) {
161161
var newEndpoint = new AWS.Endpoint(endpointStr);
162162
this.endpoint = newEndpoint;
163-
this.path = newEndpoint.path || '/'
163+
this.path = newEndpoint.path || '/';
164164
}
165165
});
166166

lib/param_validator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ AWS.ParamValidator = AWS.util.inherit({
113113
if (!Object.prototype.hasOwnProperty.call(params, param)) continue;
114114
// Validate any map key trait constraints
115115
this.validateMember(shape.key, param,
116-
context + '[key=\'' + param + '\']')
116+
context + '[key=\'' + param + '\']');
117117
this.validateMember(shape.value, params[param],
118118
context + '[\'' + param + '\']');
119119
mapCount++;

lib/protocol/helpers.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function populateHostPrefix(request) {
1919
prependEndpointPrefix(request.httpRequest.endpoint, hostPrefix);
2020
validateHostname(request.httpRequest.endpoint.hostname);
2121
}
22-
return request
22+
return request;
2323
}
2424

2525
/**
@@ -67,15 +67,15 @@ function prependEndpointPrefix(endpoint, prefix) {
6767
* @api private
6868
*/
6969
function validateHostname(hostname) {
70-
var labels = hostname.split('.')
70+
var labels = hostname.split('.');
7171
//Reference: https://tools.ietf.org/html/rfc1123#section-2
7272
var hostPattern = /^[a-zA-Z0-9]{1}$|^[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]$/;
7373
util.arrayEach(labels, function(label) {
7474
if (!label.length || label.length < 1 || label.length > 63) {
7575
throw util.error(new Error(), {
7676
code: 'ValidationError',
7777
message: 'Hostname label length should be between 1 to 63 characters, inclusive.'
78-
})
78+
});
7979
}
8080
if (!hostPattern.test(label)) {
8181
throw AWS.util.error(new Error(),
@@ -86,4 +86,4 @@ function validateHostname(hostname) {
8686

8787
module.exports = {
8888
populateHostPrefix: populateHostPrefix
89-
}
89+
};

0 commit comments

Comments
 (0)