Skip to content

Commit

Permalink
fix: update eslint, enforce semi, apply to test dir (#2336)
Browse files Browse the repository at this point in the history
  • Loading branch information
jstewmon authored and AllanZhengYP committed Jan 22, 2019
1 parent fd8fc03 commit cb1604c
Show file tree
Hide file tree
Showing 135 changed files with 1,608 additions and 1,599 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/*
test/browser/**/*
4 changes: 3 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
"rules": {
"quotes": [2, "single"],
"strict": 0,
"eol-last": ["error", "always"],
"curly": 0,
"no-empty": 0,
"no-underscore-dangle": 0,
"new-cap": 0,
"dot-notation": 0,
"no-use-before-define": 0,
"space-after-keywords": [2, "always"],
"semi": [2, "always"],
"keyword-spacing": [2, {"before": true, "after": true}],
"space-before-blocks": [2, "always"],
"no-trailing-spaces": 2,
"space-unary-ops": 0
Expand Down
8 changes: 4 additions & 4 deletions dist-tools/client-creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ ClientCreator.prototype.generateClientFileSource = function generateClientFileSo
}
code += 'Object.defineProperty(apiLoader.services[\'' + serviceName +'\'], \'' + version + '\', {\n';
code += tab + 'get: function get() {\n';
code += tab + tab + 'var model = require(\'../apis/' + versionInfo.api + '.json\');\n'
code += tab + tab + 'var model = require(\'../apis/' + versionInfo.api + '.json\');\n';
if (versionInfo.hasOwnProperty('paginators')) {
code += tab + tab + 'model.paginators = require(\'../apis/' + versionInfo.paginators + '.json\').pagination;\n';
}
Expand All @@ -125,7 +125,7 @@ ClientCreator.prototype.generateClientFileSource = function generateClientFileSo
code: code,
path: path.join(clientFolderPath, serviceName + '.js'),
service: serviceName,
}
};
};

ClientCreator.prototype.tabs = function tabs(count) {
Expand All @@ -134,7 +134,7 @@ ClientCreator.prototype.tabs = function tabs(count) {
tab += ' ';
}
return tab;
}
};

ClientCreator.prototype.generateDefinePropertySource = function generateDefinePropertySource(objName, serviceName, className) {
var tabs = this.tabs;
Expand Down Expand Up @@ -211,4 +211,4 @@ ClientCreator.prototype.writeClientServices = function writeClientServices() {
fs.writeFileSync(browserClientInfo.path, browserClientInfo.code);
};

module.exports = ClientCreator;
module.exports = ClientCreator;
2 changes: 1 addition & 1 deletion dist-tools/create-all-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ var ClientCreator = require('./client-creator');
var cc = new ClientCreator();

cc.writeClientServices();
console.log('Finished updating services.');
console.log('Finished updating services.');
2 changes: 1 addition & 1 deletion dist-tools/service-collector.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@ function ServiceCollector(services) {
return serviceCode;
}

module.exports = ServiceCollector;
module.exports = ServiceCollector;
2 changes: 1 addition & 1 deletion dist-tools/webpack.config.rn-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ module.exports = {
}
]
}
}
};
2 changes: 1 addition & 1 deletion dist-tools/webpack.config.rn-dep.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ module.exports = {
}
]
}
}
};
2 changes: 1 addition & 1 deletion dist-tools/webpack.config.rn.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ module.exports = {
}
]
}
}
};
2 changes: 1 addition & 1 deletion lib/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ if (typeof self !== 'undefined') self.AWS = AWS;
* DO NOT REMOVE
* browser builder will strip out this line if services are supplied on the command line.
*/
require('../clients/browser_default');
require('../clients/browser_default');
2 changes: 1 addition & 1 deletion lib/browserCryptoLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ module.exports = exports = {
createSign: function() {
throw new Error('createSign is not implemented in the browser');
}
}
};
2 changes: 1 addition & 1 deletion lib/browserHashUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ function convertToBuffer(data) {
module.exports = exports = {
isEmptyData: isEmptyData,
convertToBuffer: convertToBuffer,
}
};
2 changes: 1 addition & 1 deletion lib/browserHmac.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Hmac.prototype.digest = function (encoding) {
}

return this.outer.digest(encoding);
}
};

function bufferFromSecret(hashCtor, secret) {
var input = hashUtils.convertToBuffer(secret);
Expand Down
2 changes: 1 addition & 1 deletion lib/browserSha1.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ Sha1.prototype.processBlock = function processBlock() {
for (i = 0; i < 16; i++) {
this.block[i] = 0;
}
}
};
4 changes: 2 additions & 2 deletions lib/cloudfront/signer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var queryEncode = function (string) {
var signPolicy = function (policy, privateKey) {
var sign = crypto.createSign('RSA-SHA1');
sign.write(policy);
return queryEncode(sign.sign(privateKey, 'base64'))
return queryEncode(sign.sign(privateKey, 'base64'));
};

var signWithCannedPolicy = function (url, expires, keyPairId, privateKey) {
Expand All @@ -45,7 +45,7 @@ var signWithCustomPolicy = function (policy, keyPairId, privateKey) {
Policy: queryEncode(base64Encode(policy)),
'Key-Pair-Id': keyPairId,
Signature: signPolicy(policy, privateKey)
}
};
};

var determineScheme = function (url) {
Expand Down
2 changes: 1 addition & 1 deletion lib/credentials/chainable_temporary_credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ AWS.ChainableTemporaryCredentials = AWS.util.inherit(AWS.Credentials, {
this.expired = true;
this.tokenCodeFn = null;

var params = AWS.util.copy(options.params) || {}
var params = AWS.util.copy(options.params) || {};
if (params.RoleArn) {
params.RoleSessionName = params.RoleSessionName || 'temporary-credentials';
}
Expand Down
6 changes: 3 additions & 3 deletions lib/discover_endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ function getCacheKey(request) {
identifiers.region = service.config.region;
}
if (api.serviceId) {
identifiers.serviceId = api.serviceId
identifiers.serviceId = api.serviceId;
}
if (service.config.credentials.accessKeyId) {
identifiers.accessKeyId = service.config.credentials.accessKeyId
identifiers.accessKeyId = service.config.credentials.accessKeyId;
}
return identifiers;
}
Expand Down Expand Up @@ -356,4 +356,4 @@ module.exports = {
marshallCustomIdentifiers: marshallCustomIdentifiers,
getCacheKey: getCacheKey,
invalidateCachedEndpoint: invalidateCachedEndpoints,
}
};
2 changes: 1 addition & 1 deletion lib/dynamodb/numberValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ var DynamoDBNumberValue = util.inherit({
/**
* @api private
*/
module.exports = DynamoDBNumberValue;
module.exports = DynamoDBNumberValue;
2 changes: 1 addition & 1 deletion lib/empty.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
/**
* @api private
*/
module.exports = {};
module.exports = {};
2 changes: 1 addition & 1 deletion lib/event-stream/alloc-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ function allocBuffer(size) {
*/
module.exports = {
allocBuffer: allocBuffer
};
};
2 changes: 1 addition & 1 deletion lib/event-stream/buffered-create-event-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ function createEventStream(body, parser, model) {
*/
module.exports = {
createEventStream: createEventStream
};
};
2 changes: 1 addition & 1 deletion lib/event-stream/build-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
module.exports = {
buildMessage: buildMessage
};
};
4 changes: 2 additions & 2 deletions lib/event-stream/event-message-chunker-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ EventMessageChunkerStream.prototype._flush = function(callback) {
} else {
callback();
}
}
};

/**
* @param {number} size Size of the message to be allocated.
Expand All @@ -117,4 +117,4 @@ EventMessageChunkerStream.prototype.allocateMessage = function(size) {
*/
module.exports = {
EventMessageChunkerStream: EventMessageChunkerStream
};
};
2 changes: 1 addition & 1 deletion lib/event-stream/event-message-chunker.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ function eventMessageChunker(buffer) {
*/
module.exports = {
eventMessageChunker: eventMessageChunker
};
};
2 changes: 1 addition & 1 deletion lib/event-stream/event-message-unmarshaller-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ EventUnmarshallerStream.prototype._transform = function(chunk, encoding, callbac
*/
module.exports = {
EventUnmarshallerStream: EventUnmarshallerStream
};
};
4 changes: 2 additions & 2 deletions lib/event-stream/int64.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Int64.fromNumber = function(number) {
);
}

var bytes = new Uint8Array(8)
var bytes = new Uint8Array(8);
for (
var i = 7, remaining = Math.abs(Math.round(number));
i > -1 && remaining > 0;
Expand Down Expand Up @@ -90,4 +90,4 @@ function negate(bytes) {
*/
module.exports = {
Int64: Int64
};
};
2 changes: 1 addition & 1 deletion lib/event-stream/parse-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ function parseError(message) {
*/
module.exports = {
parseEvent: parseEvent
};
};
2 changes: 1 addition & 1 deletion lib/event-stream/parse-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ function parseMessage(message) {
*/
module.exports = {
parseMessage: parseMessage
};
};
2 changes: 1 addition & 1 deletion lib/event-stream/split-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ function splitMessage(message) {
*/
module.exports = {
splitMessage: splitMessage
};
};
2 changes: 1 addition & 1 deletion lib/event-stream/streaming-create-event-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ function createEventStream(stream, parser, model) {
*/
module.exports = {
createEventStream: createEventStream
};
};
2 changes: 1 addition & 1 deletion lib/event-stream/to-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ function toBuffer(data, encoding) {
*/
module.exports = {
toBuffer: toBuffer
};
};
10 changes: 5 additions & 5 deletions lib/event_listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,23 +512,23 @@ AWS.EventListeners = {
} else {
struct[subShapeName] = subShape;
}
})
return struct
});
return struct;
case 'list':
var list = [];
AWS.util.arrayEach(shape, function(subShape, index) {
list.push(filterSensitiveLog(inputShape.member, subShape));
})
});
return list;
case 'map':
var map = {};
AWS.util.each(shape, function(key, value) {
map[key] = filterSensitiveLog(inputShape.value, value);
})
});
return map;
default:
if (inputShape.isSensitive) {
return '***SensitiveInformation***'
return '***SensitiveInformation***';
} else {
return shape;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ AWS.HttpRequest = inherit({
updateEndpoint: function updateEndpoint(endpointStr) {
var newEndpoint = new AWS.Endpoint(endpointStr);
this.endpoint = newEndpoint;
this.path = newEndpoint.path || '/'
this.path = newEndpoint.path || '/';
}
});

Expand Down
2 changes: 1 addition & 1 deletion lib/param_validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ AWS.ParamValidator = AWS.util.inherit({
if (!Object.prototype.hasOwnProperty.call(params, param)) continue;
// Validate any map key trait constraints
this.validateMember(shape.key, param,
context + '[key=\'' + param + '\']')
context + '[key=\'' + param + '\']');
this.validateMember(shape.value, params[param],
context + '[\'' + param + '\']');
mapCount++;
Expand Down
8 changes: 4 additions & 4 deletions lib/protocol/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function populateHostPrefix(request) {
prependEndpointPrefix(request.httpRequest.endpoint, hostPrefix);
validateHostname(request.httpRequest.endpoint.hostname);
}
return request
return request;
}

/**
Expand Down Expand Up @@ -67,15 +67,15 @@ function prependEndpointPrefix(endpoint, prefix) {
* @api private
*/
function validateHostname(hostname) {
var labels = hostname.split('.')
var labels = hostname.split('.');
//Reference: https://tools.ietf.org/html/rfc1123#section-2
var hostPattern = /^[a-zA-Z0-9]{1}$|^[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]$/;
util.arrayEach(labels, function(label) {
if (!label.length || label.length < 1 || label.length > 63) {
throw util.error(new Error(), {
code: 'ValidationError',
message: 'Hostname label length should be between 1 to 63 characters, inclusive.'
})
});
}
if (!hostPattern.test(label)) {
throw AWS.util.error(new Error(),
Expand All @@ -86,4 +86,4 @@ function validateHostname(hostname) {

module.exports = {
populateHostPrefix: populateHostPrefix
}
};
Loading

0 comments on commit cb1604c

Please sign in to comment.