Skip to content

Commit 7332417

Browse files
authored
eslint fixes (#79)
* eslint fixes * Update merchandising.js Remove erroneous console
1 parent 6614677 commit 7332417

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
lines changed

src/buildURL.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
'use strict';
2+
23
/**
34
* This method is used to build the url based on
45
* the type of request.
56
*/
67

78
const buildURL = {
9+
810
/**
911
* Builds the findings(search) URL.
1012
*

src/findingApi.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ const findItemsByKeywords = function (options) {
2020
const url = urlObject.buildSearchUrl(this.options);
2121
return getRequest(url).then((data) => {
2222
return JSON.parse(data).findItemsByKeywordsResponse;
23-
24-
}, console.error
23+
}, console.error // eslint-disable-line no-console
2524
);
2625
};
2726

@@ -33,8 +32,7 @@ const findItemsByCategory = function (categoryID) {
3332
const url = urlObject.buildSearchUrl(this.options);
3433
return getRequest(url).then((data) => {
3534
return JSON.parse(data).findItemsByCategoryResponse;
36-
37-
}, console.error
35+
}, console.error // eslint-disable-line no-console
3836
);
3937
};
4038

@@ -55,7 +53,7 @@ const findCompletedItems = function (options) {
5553
return getRequest(url).then((data) => {
5654
return JSON.parse(data).findCompletedItemsResponse;
5755

58-
}, console.error
56+
}, console.error // eslint-disable-line no-console
5957
);
6058
};
6159

@@ -75,7 +73,7 @@ const findItemsAdvanced = function (options) {
7573
const url = urlObject.buildSearchUrl(this.options);
7674
return getRequest(url).then((data) => {
7775
return JSON.parse(data).findItemsAdvancedResponse;
78-
}, console.error
76+
}, console.error // eslint-disable-line no-console
7977
);
8078
};
8179

@@ -85,7 +83,7 @@ const getVersion = function () {
8583
const url = urlObject.buildSearchUrl(this.options);
8684
return getRequest(url).then((data) => {
8785
return JSON.parse(data).getVersionResponse[0];
88-
}, console.error
86+
}, console.error // eslint-disable-line no-console
8987
);
9088
};
9189

@@ -104,7 +102,7 @@ const findItemsByProduct = function (options) {
104102
return getRequest(url).then((data) => {
105103
return JSON.parse(data).findItemsByProductResponse;
106104

107-
}, console.error
105+
}, console.error // eslint-disable-line no-console
108106
);
109107
};
110108

src/merchandising.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const getMostWatchedItems = function (merchOptions) {
1717
return getRequest(`http://${this.options.baseSvcUrl}/${MERCH_SRVC_NAME}?OPERATION-NAME=getMostWatchedItems&SERVICE-NAME=${MERCH_SRVC_NAME}&SERVICE-VERSION=1.1.0&CONSUMER-ID=${this.options.clientID}&RESPONSE-DATA-FORMAT=JSON&REST-PAYLOAD${url}`).then((result) => {
1818
return JSON.parse(result);
1919
}).catch((error) => {
20-
console.log(error);
20+
console.log(error); // eslint-disable-line no-console
2121
});
2222
};
2323

@@ -30,11 +30,10 @@ const getMostWatchedItems = function (merchOptions) {
3030
const getSimilarItems = function (merchOptions) {
3131
if (!this.options.clientID) throw new Error('Missing App id or client id');
3232
const url = parseObj(merchOptions);
33-
console.log(`http://${this.options.baseSvcUrl}/${MERCH_SRVC_NAME}?OPERATION-NAME=getSimilarItems&SERVICE-NAME=${MERCH_SRVC_NAME}&SERVICE-VERSION=1.1.0&CONSUMER-ID=${this.options.clientID}&RESPONSE-DATA-FORMAT=JSON&REST-PAYLOAD${url}`);
3433
return getRequest(`http://${this.options.baseSvcUrl}/${MERCH_SRVC_NAME}?OPERATION-NAME=getSimilarItems&SERVICE-NAME=${MERCH_SRVC_NAME}&SERVICE-VERSION=1.1.0&CONSUMER-ID=${this.options.clientID}&RESPONSE-DATA-FORMAT=JSON&REST-PAYLOAD${url}`).then((result) => {
3534
return JSON.parse(result);
3635
}).catch((error) => {
37-
console.log(error);
36+
console.log(error); // eslint-disable-line no-console
3837
});
3938
};
4039

src/request.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const qs = require('querystring');
44

55
const getRequest = (url) => {
66
if (url.includes('http://')) httpRequest = require('http');
7-
return new Promise(function (resolve, reject) {
7+
return new Promise(((resolve, reject) => {
88
httpRequest.get(url, res => {
99
res.setEncoding('utf8');
1010
let body = '';
@@ -22,7 +22,7 @@ const getRequest = (url) => {
2222

2323
});
2424
});
25-
});
25+
}));
2626
};
2727

2828
const makeRequest = function postRequest(self, endpoint, methodName, token) {
@@ -44,7 +44,7 @@ const makeRequest = function postRequest(self, endpoint, methodName, token) {
4444
...self.headers
4545
}
4646
};
47-
return new Promise(function (resolve, reject) {
47+
return new Promise(((resolve, reject) => {
4848
const req = httpRequest.request(options, res => {
4949
res.setEncoding('utf8');
5050
let body = '';
@@ -64,7 +64,7 @@ const makeRequest = function postRequest(self, endpoint, methodName, token) {
6464
//console.log('request ' + dataString);
6565
if (methodName === 'POST') req.write(dataString);
6666
req.end();
67-
});
67+
}));
6868
};
6969

7070

src/shopping.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const getAllCategories = function (categoryID) {
1111
const url = urlObject.buildShoppingUrl(this.options);
1212
return getRequest(url).then((data) => {
1313
return JSON.parse(data);
14-
}, console.error
14+
}, console.error // eslint-disable-line no-console
1515
);
1616
};
1717

@@ -25,7 +25,7 @@ const getUserDetails = function (input) {
2525
const url = urlObject.buildShoppingUrl(this.options);
2626
return getRequest(url).then((data) => {
2727
return JSON.parse(data);
28-
}, console.error
28+
}, console.error // eslint-disable-line no-console
2929
);
3030
};
3131

@@ -37,7 +37,7 @@ const getItemStatus = function (itemIds) {
3737
const url = urlObject.buildShoppingUrl(this.options);
3838
return getRequest(url).then((data) => {
3939
return JSON.parse(data);
40-
}, console.error
40+
}, console.error // eslint-disable-line no-console
4141
);
4242
};
4343

@@ -54,7 +54,7 @@ const getShippingCosts = function (input) {
5454
url = url + params;
5555
return getRequest(url).then((data) => {
5656
return JSON.parse(data);
57-
}, console.error
57+
}, console.error // eslint-disable-line no-console
5858
);
5959
};
6060

0 commit comments

Comments
 (0)