Skip to content

Commit acef874

Browse files
committed
linting
1 parent 7dae858 commit acef874

File tree

10 files changed

+50
-51
lines changed

10 files changed

+50
-51
lines changed

browser/swagger-client.js

Lines changed: 11 additions & 11 deletions
Large diffs are not rendered by default.

browser/swagger-client.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/client.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ SwaggerClient.prototype.initialize = function (url, options) {
139139

140140
if (options.enableCookies) {
141141
this.enableCookies = options.enableCookies;
142-
};
142+
}
143143

144144
this.options = options || {};
145145

@@ -452,7 +452,7 @@ SwaggerClient.prototype.makeUniqueOperationId = function(operationId, api) {
452452
if(operation.nickname === name) {
453453
matched = true;
454454
}
455-
})
455+
});
456456
if(!matched) {
457457
return name;
458458
}
@@ -461,7 +461,7 @@ SwaggerClient.prototype.makeUniqueOperationId = function(operationId, api) {
461461
}
462462

463463
return operationId;
464-
}
464+
};
465465

466466
SwaggerClient.prototype.parseUri = function (uri) {
467467
var urlParseRE = /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;

lib/http.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ SwaggerHttp.prototype.execute = function (obj, opts) {
4040
hasJQuery = true;
4141
}
4242
}
43-
if(this.isInternetExplorer() && (obj.useJQuery === false || !hasJquery )) {
44-
throw new Exception('Unsupported configuration! JQuery is required but not available');
43+
if(this.isInternetExplorer() && (obj.useJQuery === false || !hasJQuery )) {
44+
throw new Error('Unsupported configuration! JQuery is required but not available');
4545
}
4646
if ((obj && obj.useJQuery === true) || this.isInternetExplorer() && hasJQuery) {
4747
client = new JQueryHttpClient(opts);
@@ -54,7 +54,7 @@ SwaggerHttp.prototype.execute = function (obj, opts) {
5454
data = opts.requestInterceptor.apply(data);
5555
}
5656
return data;
57-
}
57+
};
5858

5959
var responseInterceptor = function(data) {
6060
if(opts && opts.responseInterceptor) {
@@ -104,7 +104,7 @@ SwaggerHttp.prototype.isInternetExplorer = function () {
104104
};
105105

106106
JQueryHttpClient.prototype.execute = function (obj) {
107-
var jq = jQuery || window.jQuery;
107+
var jq = this.jQuery || window.jQuery;
108108
var cb = obj.on;
109109
var request = obj;
110110

lib/resolver.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ Resolver.prototype.resolveTo = function (root, property, resolutionTable, locati
587587
this.resolveTo(root, items, resolutionTable, location);
588588
} else {
589589
if(property && property.properties) {
590-
var name = this.uniqueName("inline_model");
590+
var name = this.uniqueName('inline_model');
591591
this.spec.definitions[name] = _.cloneDeep(property);
592592
property['$ref'] = '#/definitions/' + name;
593593
delete property.type;
@@ -606,7 +606,7 @@ Resolver.prototype.uniqueName = function(base) {
606606
name = base + '_' + count;
607607
count++;
608608
}
609-
}
609+
};
610610

611611
Resolver.prototype.resolveAllOf = function(spec, obj, depth) {
612612
depth = depth || 0;
@@ -627,7 +627,7 @@ Resolver.prototype.resolveAllOf = function(spec, obj, depth) {
627627
var allOf = item.allOf;
628628
if(_.isArray(allOf)) {
629629
var output = _.cloneDeep(item);
630-
delete output['allOf'];
630+
delete output.allOf;
631631

632632
output['x-composed'] = true;
633633
if (typeof item['x-resolved-from'] !== 'undefined') {

test/compat/converter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ describe('converts specs', function () {
305305
apply: function (requestObj) {
306306
// rewrites an invalid pet id (-100) to be valid (1)
307307
// you can do what you want here, like inject headers, etc.
308-
callCount += 1
308+
callCount += 1;
309309
return requestObj;
310310
}
311311
}
@@ -319,7 +319,7 @@ describe('converts specs', function () {
319319
var operation = client.apis.pet.operations.getPetById;
320320
expect(operation.successResponse[200].definition).toBeAn('object');
321321
expect(operation.responses[400].schema).toBeAn('object');
322-
expect(operation.responses[400].schema['$ref']).toBe('#/definitions/VeryBad');
322+
expect(operation.responses[400].schema.$ref).toBe('#/definitions/VeryBad');
323323
expect(callCount).toEqual(4);
324324
done();
325325
}).catch(function(e) {

test/composition.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ describe('swagger resolver', function () {
333333
api.resolve(spec, 'http://localhost:8000/v2/petstore.json', function (spec, unresolved) {
334334
expect(Object.keys(unresolved).length).toBe(0);
335335
test.object(spec);
336-
var pet = spec.definitions['Pet'];
336+
var pet = spec.definitions.Pet;
337337

338338
expect(pet).toBeAn('object');
339339
expect(pet.discriminator).toBeAn('string');

test/macros.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ var instance;
1313
/* jshint ignore:end */
1414

1515
describe('client macros', function () {
16-
/* jshint ignore:start */
1716
before(function (done) {
1817
mock.petstore(done, function (petstore, server){
1918
instance = server;

test/operation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ var quantityFD = {
3333
name: 'quantity',
3434
type: 'integer',
3535
format: 'int32'
36-
}
36+
};
3737
var nameFD = {
3838
in: 'formData',
3939
name: 'name',
4040
type: 'string'
41-
}
41+
};
4242

4343
describe('operations', function () {
4444
it('should generate a url', function () {

test/resolver.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -959,41 +959,41 @@ describe('swagger resolver', function () {
959959
it('resolves shared responses', function(done) {
960960
var api = new Resolver();
961961
var spec = {
962-
"swagger" : "2.0",
963-
"info" : {
964-
"version" : "0.0.0",
965-
"title" : "Simple API"
962+
swagger : '2.0',
963+
info : {
964+
version : '0.0.0',
965+
title : 'Simple API'
966966
},
967-
"responses": {
968-
"Success": {
969-
"description": "Success",
970-
"schema": {
971-
"type": "string"
967+
responses: {
968+
Success: {
969+
description: 'Success',
970+
schema: {
971+
type: 'string'
972972
}
973973
},
974-
"Error": {
975-
"description": "Error",
976-
"schema": {
977-
"type": "string"
974+
Error: {
975+
description: 'Error',
976+
schema: {
977+
type: 'string'
978978
}
979979
}
980980
},
981-
"paths" : {
982-
"/" : {
983-
"get" : {
984-
"parameters" : [ ],
985-
"responses" : {
986-
"200" : {
987-
"$ref": "#/responses/Success"
981+
paths : {
982+
'/' : {
983+
get : {
984+
parameters : [ ],
985+
responses : {
986+
200 : {
987+
$ref: '#/responses/Success'
988988
},
989-
"default": {
990-
"$ref": "#/responses/Error"
989+
default: {
990+
$ref: '#/responses/Error'
991991
}
992992
}
993993
}
994994
}
995995
},
996-
"definitions" : { }
996+
definitions : { }
997997
};
998998
api.resolve(spec, 'http://localhost:8000/v2/swagger.json', function (spec, unresolved) {
999999
var responses = spec.paths['/'].get.responses;

0 commit comments

Comments
 (0)