From bde113c7029b291166a78a789683f2fcf110baa5 Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 10:51:31 +0900 Subject: [PATCH 01/22] cleanup lint error: no-trailing-whitespace --- types/request/tslint.json | 1 - 1 file changed, 1 deletion(-) diff --git a/types/request/tslint.json b/types/request/tslint.json index 75f00111a3..c289a978d2 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -53,7 +53,6 @@ "no-var-keyword": false, "no-var-requires": false, "no-void-expression": false, - "no-trailing-whitespace": false, "object-literal-key-quotes": false, "object-literal-shorthand": false, "one-line": false, From d1806394be5b79eb0c97a0a3afa78945eaf437b5 Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 10:53:49 +0900 Subject: [PATCH 02/22] cleanup lint error: dt-header --- types/request/index.d.ts | 7 ++++++- types/request/tslint.json | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/types/request/index.d.ts b/types/request/index.d.ts index 40445d1b05..f714ab2f8c 100644 --- a/types/request/index.d.ts +++ b/types/request/index.d.ts @@ -1,6 +1,11 @@ // Type definitions for request 2.0 // Project: https://github.com/request/request -// Definitions by: Carlos Ballesteros Velasco , bonnici , Bart van der Schoor , Joe Skeen , Christopher Currens , Jon Stevens +// Definitions by: Carlos Ballesteros Velasco , +// bonnici , +// Bart van der Schoor , +// Joe Skeen , +// Christopher Currens , +// Jon Stevens // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/request/tslint.json b/types/request/tslint.json index c289a978d2..af66a7ab0e 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -8,7 +8,6 @@ "ban-types": false, "callable-types": false, "comment-format": false, - "dt-header": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, From b00a7ff72ad5f54789ad876e0dcc89958013810e Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 10:54:58 +0900 Subject: [PATCH 03/22] cleanup lint error: trim-file --- types/request/request-tests.ts | 1 - types/request/tslint.json | 1 - 2 files changed, 2 deletions(-) diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index 093a7b2b5b..ed2f05b132 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -1,4 +1,3 @@ - import request = require('request'); import http = require('http'); import stream = require('stream'); diff --git a/types/request/tslint.json b/types/request/tslint.json index af66a7ab0e..287b4ac437 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -69,7 +69,6 @@ "space-before-function-paren": false, "space-within-parens": false, "strict-export-declare-modifiers": false, - "trim-file": false, "triple-equals": false, "typedef-whitespace": false, "unified-signatures": false, From 2dde57da141f9794187c148b8a2e56ca9c7af145 Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 10:57:56 +0900 Subject: [PATCH 04/22] cleanup lint error: comment-format --- types/request/index.d.ts | 4 ++-- types/request/request-tests.ts | 22 +++++++++++----------- types/request/tslint.json | 1 - 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/types/request/index.d.ts b/types/request/index.d.ts index f714ab2f8c..4a67d198d6 100644 --- a/types/request/index.d.ts +++ b/types/request/index.d.ts @@ -240,8 +240,8 @@ declare namespace request { writable: boolean; getAgent(): http.Agent; - //start(): void; - //abort(): void; + // start(): void; + // abort(): void; pipeDest(dest: any): void; setHeader(name: string, value: string, clobber?: boolean): Request; setHeaders(headers: Headers): Request; diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index ed2f05b132..843ec4920e 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -32,12 +32,12 @@ var bodyArr: request.RequestPart[] = [{ body: value }]; -//Defaults tests +// Defaults tests (() => { const githubUrl = 'https://github.com'; const defaultJarRequest = request.defaults({ jar: true }); defaultJarRequest.get(githubUrl); - //defaultJarRequest(); //this line doesn't compile (and shouldn't) + // defaultJarRequest(); //this line doesn't compile (and shouldn't) const defaultUrlRequest = request.defaults({ url: githubUrl }); defaultUrlRequest(); defaultUrlRequest.get(); @@ -138,8 +138,8 @@ opt.uri = str; // --- --- --- --- --- --- --- --- --- --- --- --- agent = req.getAgent(); -//req.start(); -//req.abort(); +// req.start(); +// req.abort(); req.pipeDest(dest); req = req.setHeader(str, str); req = req.setHeader(str, str, bool); @@ -245,7 +245,7 @@ request }) .pipe(request.put('http://another.com/another.png')); -//The following examples from https://github.com/request/request +// The following examples from https://github.com/request/request request('http://www.google.com', function (error, response, body) { if (!error && response.statusCode == 200) { console.log(body); // Show the HTML for the Google homepage. @@ -571,13 +571,13 @@ request({ } }); -//requests using baseRequest() will set the 'x-token' header +// requests using baseRequest() will set the 'x-token' header var baseRequest = request.defaults({ headers: {'x-token': 'my-token'} }); -//requests using specialRequest() will include the 'x-token' header set in -//baseRequest and will also include the 'special' header +// requests using specialRequest() will include the 'x-token' header set in +// baseRequest and will also include the 'special' header var specialRequest = baseRequest.defaults({ headers: {special: 'special value'} }); @@ -666,10 +666,10 @@ request({url: url, jar: j}, function () { request('http://images.google.com'); }); -//TODO: add definitions for tough-cookie-filestore -//var FileCookieStore = require('tough-cookie-filestore'); +// TODO: add definitions for tough-cookie-filestore +// var FileCookieStore = require('tough-cookie-filestore'); // NOTE - currently the 'cookies.json' file must already exist! -//var j = request.jar(new FileCookieStore('cookies.json')); +// var j = request.jar(new FileCookieStore('cookies.json')); requestWithJar = request.defaults({ jar : j }) request('http://www.google.com', function() { request('http://images.google.com'); diff --git a/types/request/tslint.json b/types/request/tslint.json index 287b4ac437..3ce98c0314 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -7,7 +7,6 @@ "ban-comma-operator": false, "ban-types": false, "callable-types": false, - "comment-format": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, From 3c49d1b237b59f52397d90da737ea75d0eb643b4 Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 11:03:19 +0900 Subject: [PATCH 05/22] cleanup lint error: no-padding --- types/request/index.d.ts | 11 ++++------- types/request/request-tests.ts | 12 +++--------- types/request/tslint.json | 1 - 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/types/request/index.d.ts b/types/request/index.d.ts index 4a67d198d6..6455c5752f 100644 --- a/types/request/index.d.ts +++ b/types/request/index.d.ts @@ -22,10 +22,8 @@ import FormData = require('form-data'); import { Url } from 'url'; declare namespace request { - export interface RequestAPI { - + export interface RequestAPI + { defaults(options: TOptions): RequestAPI; defaults(options: RequiredUriUrl & TOptions): DefaultUriUrlRequestApi; @@ -70,9 +68,8 @@ declare namespace request { } interface DefaultUriUrlRequestApi extends RequestAPI { - + TOptions extends CoreOptions, + TUriUrlOptions> extends RequestAPI { defaults(options: TOptions): DefaultUriUrlRequestApi; (callback?: RequestCallback): TRequest; diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index 843ec4920e..f3d3e43a66 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -89,21 +89,15 @@ strOrTrueOrUndef = oauth.body_hash; var options: request.Options = { url: str, uri: str, - callback: (error: any, response: any, body: any) => { - - }, + callback: (error: any, response: any, body: any) => {}, jar: value, form: obj, oauth: value, aws: aws, qs: obj, json: value, - jsonReviver: (key: string, value: any) => { - - }, - jsonReplacer: (key: string, value: any) => { - - }, + jsonReviver: (key: string, value: any) => {}, + jsonReplacer: (key: string, value: any) => {}, multipart: value, agent: new http.Agent(), agentOptions: value, diff --git a/types/request/tslint.json b/types/request/tslint.json index 3ce98c0314..b69c5ab822 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -33,7 +33,6 @@ "no-misused-new": false, "no-namespace": false, "no-object-literal-type-assertion": false, - "no-padding": false, "no-redundant-jsdoc": false, "no-redundant-jsdoc-2": false, "no-redundant-undefined": false, From a3adeb702e93330d9e58ede06a537099dd68486e Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 11:09:29 +0900 Subject: [PATCH 06/22] Cleanup lint error: only-arrow-functions --- types/request/request-tests.ts | 68 +++++++++++++++++----------------- types/request/tslint.json | 1 - 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index f3d3e43a66..15664c98fc 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -234,13 +234,13 @@ r.post(options); request .get('http://example.com/example.png') -.on('response', function(response: any) { +.on('response', (response: any) => { // check response }) .pipe(request.put('http://another.com/another.png')); // The following examples from https://github.com/request/request -request('http://www.google.com', function (error, response, body) { +request('http://www.google.com', (error, response, body) => { if (!error && response.statusCode == 200) { console.log(body); // Show the HTML for the Google homepage. } @@ -254,7 +254,7 @@ request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img request .get('http://google.com/img.png') - .on('response', function(response: any) { + .on('response', (response: any) => { console.log(response.statusCode); // 200 console.log(response.headers['content-type']); // 'image/png' }) @@ -262,12 +262,12 @@ request request .get('http://mysite.com/doodle.png') - .on('error', function(err: any) { + .on('error', (err: any) => { console.log(err); }) .pipe(fs.createWriteStream('doodle.png')); -http.createServer(function (req, resp) { +http.createServer((req, resp) => { if (req.url === '/doodle.png') { if (req.method === 'PUT') { req.pipe(request.put('http://mysite.com/doodle.png')); @@ -277,7 +277,7 @@ http.createServer(function (req, resp) { } }); -http.createServer(function (req, resp) { +http.createServer((req, resp) => { if (req.url === '/doodle.png') { var x = request('http://mysite.com/doodle.png'); req.pipe(x); @@ -285,11 +285,11 @@ http.createServer(function (req, resp) { } }); -http.createServer(function (req, resp) { +http.createServer((req, resp) => { req.pipe(request('http://mysite.com/doodle.png')).pipe(resp); }); -http.createServer(function (req, resp) { +http.createServer((req, resp) => { if (req.url === '/doodle.png') { r.get('http://google.com/doodle.png').pipe(resp); } @@ -299,7 +299,7 @@ request.post('http://service.com/upload', {form:{key:'value'}}); // or request.post('http://service.com/upload').form({key:'value'}); // or -request.post({url:'http://service.com/upload', form: {key:'value'}}, function(err,httpResponse,body){ /* ... */ }); +request.post({url:'http://service.com/upload', form: {key:'value'}}, (err,httpResponse,body) => { /* ... */ }); var data = { // Pass a simple key-value pair @@ -353,7 +353,7 @@ request({ ] } }, - function (error, response, body) { + (error, response, body) => { if (error) { return console.error('upload failed:', error); } @@ -373,7 +373,7 @@ request({ { body: fs.createReadStream('image.png') } ] }, - function (error, response, body) { + (error, response, body) => { if (error) { return console.error('upload failed:', error); } @@ -408,7 +408,7 @@ var username = 'username', password = 'password', url = 'http://' + username + ':' + password + '@some.server.com'; -request({url: url}, function (error, response, body) { +request({url: url}, (error, response, body) => { // Do more stuff with 'body' here }); @@ -442,7 +442,7 @@ oauth = } , url = 'https://api.twitter.com/oauth/request_token' ; -request.post({url:url, oauth:oauth}, function (e, r, body) { +request.post({url:url, oauth:oauth}, (e, r, body) => { // Ideally, you would take the body in the response // and construct a URL that a user clicks on (like a sign in button). // The verifier is only available in the response after a user has @@ -466,7 +466,7 @@ request.post({url:url, oauth:oauth}, function (e, r, body) { } , url = 'https://api.twitter.com/oauth/access_token' ; - request.post({url:url, oauth:oauth}, function (e, r, body) { + request.post({url:url, oauth:oauth}, (e, r, body) => { // ready to make signed requests on behalf of the user var perm_data: any = qs.parse(body); var oauth = @@ -480,7 +480,7 @@ request.post({url:url, oauth:oauth}, function (e, r, body) { screen_name: perm_data.screen_name, user_id: perm_data.user_id }; - request.get({url:url, oauth:oauth, qs:query, json:true}, function (e, r, user) { + request.get({url:url, oauth:oauth, qs:query, json:true}, (e, r, user) => { console.log(user); }); }); @@ -577,7 +577,7 @@ var specialRequest = baseRequest.defaults({ }); const urlRequest = specialRequest.defaults({url: 'https://github.com'}); -urlRequest({}, function(error, response, body) {console.log(body);}); +urlRequest({}, (error, response, body) => {console.log(body);}); request.put(url); request.patch(url); @@ -590,7 +590,7 @@ request.cookie('key1=value1'); request.jar(); request.debug = true; -request.get('http://10.255.255.1', {timeout: 1500}, function(err) { +request.get('http://10.255.255.1', {timeout: 1500}, (err) => { console.log(err.code === 'ETIMEDOUT'); // Set to `true` if the timeout was a connection timeout, `false` or // `undefined` otherwise. @@ -609,7 +609,7 @@ var rand = Math.floor(Math.random()*100000000).toString(); , { body: 'I am an attachment' } ] } - , function (error, response, body) { + , (error, response, body) => { if(response.statusCode == 201){ console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand) } else { @@ -624,31 +624,31 @@ request( , uri: 'http://www.google.com' , gzip: true } - , function (error, response, body) { + , (error, response, body) => { // body is the decompressed response body console.log('server encoded the data as: ' + (response.headers['content-encoding'] || 'identity')) console.log('the decoded data is: ' + body) } - ).on('data', function(data: any) { + ).on('data', (data: any) => { // decompressed data as it is received console.log('decoded chunk: ' + data) }) - .on('response', function(response: http.IncomingMessage) { + .on('response', (response: http.IncomingMessage) => { // unmodified http.IncomingMessage object - response.on('data', function(data: any[]) { + response.on('data', (data: any[]) => { // compressed data as it is received console.log('received ' + data.length + ' bytes of compressed data') }) }); var requestWithJar = request.defaults({jar: true}) -requestWithJar('http://www.google.com', function () { +requestWithJar('http://www.google.com', () => { requestWithJar('http://images.google.com'); }); var j = request.jar() requestWithJar = request.defaults({jar:j}) -requestWithJar('http://www.google.com', function () { +requestWithJar('http://www.google.com', () => { requestWithJar('http://images.google.com'); }); @@ -656,7 +656,7 @@ var j = request.jar(); cookie = request.cookie('key1=value1'); var url = 'http://www.google.com'; j.setCookie(cookie, url); -request({url: url, jar: j}, function () { +request({url: url, jar: j}, () => { request('http://images.google.com'); }); @@ -665,12 +665,12 @@ request({url: url, jar: j}, function () { // NOTE - currently the 'cookies.json' file must already exist! // var j = request.jar(new FileCookieStore('cookies.json')); requestWithJar = request.defaults({ jar : j }) -request('http://www.google.com', function() { +request('http://www.google.com', () => { request('http://images.google.com'); }); var j = request.jar() -request({url: 'http://www.google.com', jar: j}, function () { +request({url: 'http://www.google.com', jar: j}, () => { var cookie_string = j.getCookieString(url); // "key1=value1; key2=value2; ..." var cookies = j.getCookies(url); // [{key: 'key1', value: 'value1', domain: "www.google.com", ...}, ...] @@ -682,11 +682,11 @@ request( , gzip: true } ) - .on('request', function(req: http.ClientRequest) { }) - .on('response', function(resp: http.IncomingMessage) { }) - .on('data', function(data: Buffer | string) { }) - .on('error', function(e: Error) { }) - .on('complete', function(resp: http.IncomingMessage, body?: string | Buffer) { }); + .on('request', (req: http.ClientRequest) => { }) + .on('response', (resp: http.IncomingMessage) => { }) + .on('data', (data: Buffer | string) => { }) + .on('error', (e: Error) => { }) + .on('complete', (resp: http.IncomingMessage, body?: string | Buffer) => { }); // options.url / options.uri can be the Url object request.get({ @@ -713,11 +713,11 @@ requestWithOptionalUri({ url: urlModule.parse('http://example.com') }); requestWithOptionalUri('http://example.com'); -requestWithOptionalUri(function() {}); +requestWithOptionalUri(() => {}); requestWithOptionalUri.get(); -requestWithOptionalUri.get(function() {}); +requestWithOptionalUri.get(() => {}); requestWithOptionalUri.get('http://example.com'); diff --git a/types/request/tslint.json b/types/request/tslint.json index b69c5ab822..a37883fcfa 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -54,7 +54,6 @@ "object-literal-shorthand": false, "one-line": false, "one-variable-per-declaration": false, - "only-arrow-functions": false, "prefer-conditional-expression": false, "prefer-const": false, "prefer-declare-function": false, From 0339b28f8047e7cf5753422e381e499871f73646 Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 11:13:49 +0900 Subject: [PATCH 07/22] cleanup lint error: one-line --- types/request/index.d.ts | 3 +-- types/request/request-tests.ts | 45 +++++++++++++++++----------------- types/request/tslint.json | 1 - 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/types/request/index.d.ts b/types/request/index.d.ts index 6455c5752f..dbe65da3a5 100644 --- a/types/request/index.d.ts +++ b/types/request/index.d.ts @@ -22,8 +22,7 @@ import FormData = require('form-data'); import { Url } from 'url'; declare namespace request { - export interface RequestAPI - { + export interface RequestAPI { defaults(options: TOptions): RequestAPI; defaults(options: RequiredUriUrl & TOptions): DefaultUriUrlRequestApi; diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index 15664c98fc..7f57dc8946 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -434,14 +434,14 @@ request(options, callback); import qs = require('querystring'); const CONSUMER_KEY = 'key'; const CONSUMER_SECRET = 'secret'; -oauth = - { callback: 'http://mysite.com/callback/' - , consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , transport_method: 'header' +oauth = { + callback: 'http://mysite.com/callback/', + consumer_key: CONSUMER_KEY, + consumer_secret: CONSUMER_SECRET, + transport_method: 'header' } - , url = 'https://api.twitter.com/oauth/request_token' - ; + , url = 'https://api.twitter.com/oauth/request_token'; + request.post({url:url, oauth:oauth}, (e, r, body) => { // Ideally, you would take the body in the response // and construct a URL that a user clicks on (like a sign in button). @@ -457,24 +457,23 @@ request.post({url:url, oauth:oauth}, (e, r, body) => { // step 3 // after the user is redirected back to your server var auth_data: any = qs.parse(body) - , oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: auth_data.oauth_token - , token_secret: req_data.oauth_token_secret as string - , verifier: auth_data.oauth_verifier - } - , url = 'https://api.twitter.com/oauth/access_token' - ; + , oauth = { + consumer_key: CONSUMER_KEY, + consumer_secret: CONSUMER_SECRET, + token: auth_data.oauth_token, + token_secret: req_data.oauth_token_secret as string, + verifier: auth_data.oauth_verifier + }, url = 'https://api.twitter.com/oauth/access_token'; + request.post({url:url, oauth:oauth}, (e, r, body) => { // ready to make signed requests on behalf of the user var perm_data: any = qs.parse(body); - var oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: perm_data.oauth_token - , token_secret: perm_data.oauth_token_secret - }; + var oauth = { + consumer_key: CONSUMER_KEY, + consumer_secret: CONSUMER_SECRET, + token: perm_data.oauth_token, + token_secret: perm_data.oauth_token_secret + }; var url = 'https://api.twitter.com/1.1/users/show.json'; var query = { screen_name: perm_data.screen_name, @@ -610,7 +609,7 @@ var rand = Math.floor(Math.random()*100000000).toString(); ] } , (error, response, body) => { - if(response.statusCode == 201){ + if(response.statusCode == 201) { console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand) } else { console.log('error: '+ response.statusCode) diff --git a/types/request/tslint.json b/types/request/tslint.json index a37883fcfa..21ab8a214b 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -52,7 +52,6 @@ "no-void-expression": false, "object-literal-key-quotes": false, "object-literal-shorthand": false, - "one-line": false, "one-variable-per-declaration": false, "prefer-conditional-expression": false, "prefer-const": false, From 8d2da56ea51e335f0247be40f02a121750aced02 Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 11:15:24 +0900 Subject: [PATCH 08/22] cleanup lint error: arrow-return-shorthand --- types/request/tslint.json | 1 - 1 file changed, 1 deletion(-) diff --git a/types/request/tslint.json b/types/request/tslint.json index 21ab8a214b..8f9210f781 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -3,7 +3,6 @@ "rules": { "adjacent-overload-signatures": false, "array-type": false, - "arrow-return-shorthand": false, "ban-comma-operator": false, "ban-types": false, "callable-types": false, From a2e8bfda4ea4ff040f8f589f3eb17e1b048ff2a6 Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 11:16:35 +0900 Subject: [PATCH 09/22] cleanup lint error: ban-comma-operator --- types/request/request-tests.ts | 4 ++-- types/request/tslint.json | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index 7f57dc8946..c6df4714f5 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -439,8 +439,8 @@ oauth = { consumer_key: CONSUMER_KEY, consumer_secret: CONSUMER_SECRET, transport_method: 'header' - } - , url = 'https://api.twitter.com/oauth/request_token'; +}; +url = 'https://api.twitter.com/oauth/request_token'; request.post({url:url, oauth:oauth}, (e, r, body) => { // Ideally, you would take the body in the response diff --git a/types/request/tslint.json b/types/request/tslint.json index 8f9210f781..013ddb155a 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -3,7 +3,6 @@ "rules": { "adjacent-overload-signatures": false, "array-type": false, - "ban-comma-operator": false, "ban-types": false, "callable-types": false, "eofline": false, From 7439f6d08fd66f54090d7e9499d54959f9fb57da Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 11:20:34 +0900 Subject: [PATCH 10/22] cleanup lint errors: whitespace, typedef-whitespace, space-within-parens, space-before-function-paren --- types/request/request-tests.ts | 26 +++++++++++++------------- types/request/tslint.json | 6 +----- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index c6df4714f5..54cd9c8a7a 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -295,11 +295,11 @@ http.createServer((req, resp) => { } }); -request.post('http://service.com/upload', {form:{key:'value'}}); +request.post('http://service.com/upload', {form: {key: 'value'}}); // or -request.post('http://service.com/upload').form({key:'value'}); +request.post('http://service.com/upload').form({key: 'value'}); // or -request.post({url:'http://service.com/upload', form: {key:'value'}}, (err,httpResponse,body) => { /* ... */ }); +request.post({url: 'http://service.com/upload', form: {key: 'value'}}, (err, httpResponse, body) => { /* ... */ }); var data = { // Pass a simple key-value pair @@ -324,7 +324,7 @@ var data = { } } }; -request.post({url:'http://service.com/upload', formData: data}, function optionalCallback(err, httpResponse, body) { +request.post({url: 'http://service.com/upload', formData: data}, function optionalCallback(err, httpResponse, body) { if (err) { return console.error('upload failed:', err); } @@ -442,7 +442,7 @@ oauth = { }; url = 'https://api.twitter.com/oauth/request_token'; -request.post({url:url, oauth:oauth}, (e, r, body) => { +request.post({url: url, oauth: oauth}, (e, r, body) => { // Ideally, you would take the body in the response // and construct a URL that a user clicks on (like a sign in button). // The verifier is only available in the response after a user has @@ -465,7 +465,7 @@ request.post({url:url, oauth:oauth}, (e, r, body) => { verifier: auth_data.oauth_verifier }, url = 'https://api.twitter.com/oauth/access_token'; - request.post({url:url, oauth:oauth}, (e, r, body) => { + request.post({url: url, oauth: oauth}, (e, r, body) => { // ready to make signed requests on behalf of the user var perm_data: any = qs.parse(body); var oauth = { @@ -479,7 +479,7 @@ request.post({url:url, oauth:oauth}, (e, r, body) => { screen_name: perm_data.screen_name, user_id: perm_data.user_id }; - request.get({url:url, oauth:oauth, qs:query, json:true}, (e, r, user) => { + request.get({url: url, oauth: oauth, qs: query, json: true}, (e, r, user) => { console.log(user); }); }); @@ -576,7 +576,7 @@ var specialRequest = baseRequest.defaults({ }); const urlRequest = specialRequest.defaults({url: 'https://github.com'}); -urlRequest({}, (error, response, body) => {console.log(body);}); +urlRequest({}, (error, response, body) => { console.log(body); }); request.put(url); request.patch(url); @@ -597,7 +597,7 @@ request.get('http://10.255.255.1', {timeout: 1500}, (err) => { process.exit(0); }); -var rand = Math.floor(Math.random()*100000000).toString(); +var rand = Math.floor(Math.random() * 100000000).toString(); request( { method: 'PUT' , uri: 'http://mikeal.iriscouch.com/testjs/' + rand @@ -609,10 +609,10 @@ var rand = Math.floor(Math.random()*100000000).toString(); ] } , (error, response, body) => { - if(response.statusCode == 201) { - console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand) + if (response.statusCode == 201) { + console.log('document saved as: http://mikeal.iriscouch.com/testjs/' + rand) } else { - console.log('error: '+ response.statusCode) + console.log('error: ' + response.statusCode) console.log(body) } } @@ -646,7 +646,7 @@ requestWithJar('http://www.google.com', () => { }); var j = request.jar() -requestWithJar = request.defaults({jar:j}) +requestWithJar = request.defaults({jar: j}) requestWithJar('http://www.google.com', () => { requestWithJar('http://images.google.com'); }); diff --git a/types/request/tslint.json b/types/request/tslint.json index 013ddb155a..12fdeef86a 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -60,13 +60,9 @@ "prefer-template": false, "radix": false, "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, "strict-export-declare-modifiers": false, "triple-equals": false, - "typedef-whitespace": false, "unified-signatures": false, - "void-return": false, - "whitespace": false + "void-return": false } } From fd9dffdd7c280d2071b897c09ffb477bd7fe8024 Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 11:23:03 +0900 Subject: [PATCH 11/22] cleanup lint error: semicolon --- types/request/index.d.ts | 12 ++++++------ types/request/request-tests.ts | 26 +++++++++++++------------- types/request/tslint.json | 1 - 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/types/request/index.d.ts b/types/request/index.d.ts index dbe65da3a5..41fcdd1b0f 100644 --- a/types/request/index.d.ts +++ b/types/request/index.d.ts @@ -180,7 +180,7 @@ declare namespace request { export type ResponseRequest = CoreOptions & { uri: Url; - } + }; export interface RequestResponse extends http.IncomingMessage { request: ResponseRequest; @@ -210,7 +210,7 @@ declare namespace request { postData?: { mimeType?: string; params?: NameValuePair[]; - } + }; } export interface NameValuePair { @@ -294,7 +294,7 @@ declare namespace request { token_secret?: string; transport_method?: 'body' | 'header' | 'query'; verifier?: string; - body_hash?: true | string + body_hash?: true | string; } export interface HawkOptions { @@ -307,9 +307,9 @@ declare namespace request { } export interface CookieJar { - setCookie(cookie: Cookie, uri: string | url.Url, options?: any): void - getCookieString(uri: string | url.Url): string - getCookies(uri: string | url.Url): Cookie[] + setCookie(cookie: Cookie, uri: string | url.Url, options?: any): void; + getCookieString(uri: string | url.Url): string; + getCookies(uri: string | url.Url): Cookie[]; } export interface CookieValue { diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index 54cd9c8a7a..edf6f4b9e7 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -610,10 +610,10 @@ var rand = Math.floor(Math.random() * 100000000).toString(); } , (error, response, body) => { if (response.statusCode == 201) { - console.log('document saved as: http://mikeal.iriscouch.com/testjs/' + rand) + console.log('document saved as: http://mikeal.iriscouch.com/testjs/' + rand); } else { - console.log('error: ' + response.statusCode) - console.log(body) + console.log('error: ' + response.statusCode); + console.log(body); } } ); @@ -625,28 +625,28 @@ request( } , (error, response, body) => { // body is the decompressed response body - console.log('server encoded the data as: ' + (response.headers['content-encoding'] || 'identity')) - console.log('the decoded data is: ' + body) + console.log('server encoded the data as: ' + (response.headers['content-encoding'] || 'identity')); + console.log('the decoded data is: ' + body); } ).on('data', (data: any) => { // decompressed data as it is received - console.log('decoded chunk: ' + data) + console.log('decoded chunk: ' + data); }) .on('response', (response: http.IncomingMessage) => { // unmodified http.IncomingMessage object response.on('data', (data: any[]) => { // compressed data as it is received - console.log('received ' + data.length + ' bytes of compressed data') - }) + console.log('received ' + data.length + ' bytes of compressed data'); + }); }); -var requestWithJar = request.defaults({jar: true}) +var requestWithJar = request.defaults({jar: true}); requestWithJar('http://www.google.com', () => { requestWithJar('http://images.google.com'); }); -var j = request.jar() -requestWithJar = request.defaults({jar: j}) +var j = request.jar(); +requestWithJar = request.defaults({jar: j}); requestWithJar('http://www.google.com', () => { requestWithJar('http://images.google.com'); }); @@ -663,12 +663,12 @@ request({url: url, jar: j}, () => { // var FileCookieStore = require('tough-cookie-filestore'); // NOTE - currently the 'cookies.json' file must already exist! // var j = request.jar(new FileCookieStore('cookies.json')); -requestWithJar = request.defaults({ jar : j }) +requestWithJar = request.defaults({ jar : j }); request('http://www.google.com', () => { request('http://images.google.com'); }); -var j = request.jar() +var j = request.jar(); request({url: 'http://www.google.com', jar: j}, () => { var cookie_string = j.getCookieString(url); // "key1=value1; key2=value2; ..." var cookies = j.getCookies(url); diff --git a/types/request/tslint.json b/types/request/tslint.json index 12fdeef86a..2ae43c1910 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -59,7 +59,6 @@ "prefer-switch": false, "prefer-template": false, "radix": false, - "semicolon": false, "strict-export-declare-modifiers": false, "triple-equals": false, "unified-signatures": false, From cf4b4fd2ba94d275cf3579f7dc419f8ef59afc9f Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 11:41:23 +0900 Subject: [PATCH 12/22] cleanup ignore errors --- types/request/tslint.json | 45 +-------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/types/request/tslint.json b/types/request/tslint.json index 2ae43c1910..34c2b940f3 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -1,67 +1,24 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, "array-type": false, "ban-types": false, "callable-types": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, "no-var-keyword": false, "no-var-requires": false, "no-void-expression": false, "object-literal-key-quotes": false, "object-literal-shorthand": false, "one-variable-per-declaration": false, - "prefer-conditional-expression": false, "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, "prefer-switch": false, "prefer-template": false, - "radix": false, "strict-export-declare-modifiers": false, "triple-equals": false, - "unified-signatures": false, - "void-return": false + "unified-signatures": false } } From 0a487b74a22e90d37d181b65b420db9de398d24e Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 11:43:07 +0900 Subject: [PATCH 13/22] cleanup lint error: array-type --- types/request/index.d.ts | 4 ++-- types/request/tslint.json | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/types/request/index.d.ts b/types/request/index.d.ts index 41fcdd1b0f..6162f92fd8 100644 --- a/types/request/index.d.ts +++ b/types/request/index.d.ts @@ -220,10 +220,10 @@ declare namespace request { export interface Multipart { chunked?: boolean; - data?: { + data?: Array<{ 'content-type'?: string, body: string - }[]; + }>; } export interface RequestPart { diff --git a/types/request/tslint.json b/types/request/tslint.json index 34c2b940f3..f15db70fa2 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -1,7 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "array-type": false, "ban-types": false, "callable-types": false, "no-consecutive-blank-lines": false, From 6cffeea86458739707f7136e6144da56c6132649 Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 11:46:03 +0900 Subject: [PATCH 14/22] cleanup lint error: prefer-switch --- types/request/request-tests.ts | 11 +++++++---- types/request/tslint.json | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index edf6f4b9e7..b7fb521ae4 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -269,10 +269,13 @@ request http.createServer((req, resp) => { if (req.url === '/doodle.png') { - if (req.method === 'PUT') { - req.pipe(request.put('http://mysite.com/doodle.png')); - } else if (req.method === 'GET' || req.method === 'HEAD') { - request.get('http://mysite.com/doodle.png').pipe(resp); + switch (req.method) { + case 'PUT': + req.pipe(request.put('http://mysite.com/doodle.png')); + break; + case 'GET': + case 'HEAD': + request.get('http://mysite.com/doodle.png').pipe(resp); } } }); diff --git a/types/request/tslint.json b/types/request/tslint.json index f15db70fa2..cf15efe562 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -14,7 +14,6 @@ "object-literal-shorthand": false, "one-variable-per-declaration": false, "prefer-const": false, - "prefer-switch": false, "prefer-template": false, "strict-export-declare-modifiers": false, "triple-equals": false, From c775fd5830583690aa86420c6d65166a1829d78a Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 11:49:50 +0900 Subject: [PATCH 15/22] cleanup lint error: no-void-expression --- types/request/request-tests.ts | 9 ++++++--- types/request/tslint.json | 1 - 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index b7fb521ae4..c8aa9336b7 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -329,7 +329,8 @@ var data = { }; request.post({url: 'http://service.com/upload', formData: data}, function optionalCallback(err, httpResponse, body) { if (err) { - return console.error('upload failed:', err); + console.error('upload failed:', err); + return; } console.log('Upload successful! Server responded with:', body); }); @@ -358,7 +359,8 @@ request({ }, (error, response, body) => { if (error) { - return console.error('upload failed:', error); + console.error('upload failed:', error); + return; } console.log('Upload successful! Server responded with:', body); }); @@ -378,7 +380,8 @@ request({ }, (error, response, body) => { if (error) { - return console.error('upload failed:', error); + console.error('upload failed:', error); + return; } console.log('Upload successful! Server responded with:', body); }); diff --git a/types/request/tslint.json b/types/request/tslint.json index cf15efe562..c893b6b870 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -9,7 +9,6 @@ "no-misused-new": false, "no-var-keyword": false, "no-var-requires": false, - "no-void-expression": false, "object-literal-key-quotes": false, "object-literal-shorthand": false, "one-variable-per-declaration": false, From 9e6d73176fc6fc27f3401e66fcb205c22e2f4bfe Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 11:54:20 +0900 Subject: [PATCH 16/22] cleanup lint error: one-variable-per-declaration --- types/request/request-tests.ts | 27 ++++++++++++++------------- types/request/tslint.json | 1 - 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index c8aa9336b7..c4eb23f4a9 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -410,9 +410,9 @@ request.get('http://some.server.com/', { } }); -var username = 'username', - password = 'password', - url = 'http://' + username + ':' + password + '@some.server.com'; +let username = 'username'; +let password = 'password'; +var url = 'http://' + username + ':' + password + '@some.server.com'; request({url: url}, (error, response, body) => { // Do more stuff with 'body' here @@ -462,14 +462,15 @@ request.post({url: url, oauth: oauth}, (e, r, body) => { // step 3 // after the user is redirected back to your server - var auth_data: any = qs.parse(body) - , oauth = { + var auth_data: any = qs.parse(body); + var oauth = { consumer_key: CONSUMER_KEY, consumer_secret: CONSUMER_SECRET, token: auth_data.oauth_token, token_secret: req_data.oauth_token_secret as string, verifier: auth_data.oauth_verifier - }, url = 'https://api.twitter.com/oauth/access_token'; + }; + var url = 'https://api.twitter.com/oauth/access_token'; request.post({url: url, oauth: oauth}, (e, r, body) => { // ready to make signed requests on behalf of the user @@ -491,10 +492,10 @@ request.post({url: url, oauth: oauth}, (e, r, body) => { }); }); -var path = require('path') - , certFile = path.resolve(__dirname, 'ssl/client.crt') - , keyFile = path.resolve(__dirname, 'ssl/client.key') - , caFile = path.resolve(__dirname, 'ssl/ca.cert.pem'); +var path = require('path'); +var certFile = path.resolve(__dirname, 'ssl/client.crt'); +var keyFile = path.resolve(__dirname, 'ssl/client.key'); +var caFile = path.resolve(__dirname, 'ssl/ca.cert.pem'); options = { url: 'https://api.some-server.com/', @@ -506,9 +507,9 @@ options = { request.get(options); -var path = require('path') - , certFile = path.resolve(__dirname, 'ssl/client.crt') - , keyFile = path.resolve(__dirname, 'ssl/client.key'); +var path = require('path'); +var certFile = path.resolve(__dirname, 'ssl/client.crt'); +var keyFile = path.resolve(__dirname, 'ssl/client.key'); options = { url: 'https://api.some-server.com/', diff --git a/types/request/tslint.json b/types/request/tslint.json index c893b6b870..70d8cfc55c 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -11,7 +11,6 @@ "no-var-requires": false, "object-literal-key-quotes": false, "object-literal-shorthand": false, - "one-variable-per-declaration": false, "prefer-const": false, "prefer-template": false, "strict-export-declare-modifiers": false, From 63cf38db03218e79c23ae3d036da45d667b8494b Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 11:55:47 +0900 Subject: [PATCH 17/22] cleanup lint error: no-var-requires --- types/request/request-tests.ts | 3 +-- types/request/tslint.json | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index c4eb23f4a9..87305be7c7 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -4,6 +4,7 @@ import stream = require('stream'); import urlModule = require('url'); import fs = require('fs'); import FormData = require('form-data'); +import path = require('path'); var value: any; var str: string; @@ -492,7 +493,6 @@ request.post({url: url, oauth: oauth}, (e, r, body) => { }); }); -var path = require('path'); var certFile = path.resolve(__dirname, 'ssl/client.crt'); var keyFile = path.resolve(__dirname, 'ssl/client.key'); var caFile = path.resolve(__dirname, 'ssl/ca.cert.pem'); @@ -507,7 +507,6 @@ options = { request.get(options); -var path = require('path'); var certFile = path.resolve(__dirname, 'ssl/client.crt'); var keyFile = path.resolve(__dirname, 'ssl/client.key'); diff --git a/types/request/tslint.json b/types/request/tslint.json index 70d8cfc55c..2fa77ee874 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -8,7 +8,6 @@ "no-inferrable-types": false, "no-misused-new": false, "no-var-keyword": false, - "no-var-requires": false, "object-literal-key-quotes": false, "object-literal-shorthand": false, "prefer-const": false, From 964a5b5515062c83d60cb91726422dcaa7594e88 Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 12:13:40 +0900 Subject: [PATCH 18/22] cleanup lint error: prefer-template --- types/request/request-tests.ts | 7 +++---- types/request/tslint.json | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index 87305be7c7..ef47ebeb3d 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -413,7 +413,7 @@ request.get('http://some.server.com/', { let username = 'username'; let password = 'password'; -var url = 'http://' + username + ':' + password + '@some.server.com'; +var url = `http://'${username}:${password}'@some.server.com`; request({url: url}, (error, response, body) => { // Do more stuff with 'body' here @@ -457,8 +457,7 @@ request.post({url: url, oauth: oauth}, (e, r, body) => { // step 2 var req_data = qs.parse(body); - var uri = 'https://api.twitter.com/oauth/authenticate' - + '?' + qs.stringify({oauth_token: req_data.oauth_token}); + var uri = `https://api.twitter.com/oauth/authenticate?${qs.stringify({oauth_token: req_data.oauth_token})}`; // redirect the user to the authorize uri // step 3 @@ -642,7 +641,7 @@ request( // unmodified http.IncomingMessage object response.on('data', (data: any[]) => { // compressed data as it is received - console.log('received ' + data.length + ' bytes of compressed data'); + console.log(`received ${data.length} bytes of compressed data`); }); }); diff --git a/types/request/tslint.json b/types/request/tslint.json index 2fa77ee874..26b488e3d9 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -11,7 +11,6 @@ "object-literal-key-quotes": false, "object-literal-shorthand": false, "prefer-const": false, - "prefer-template": false, "strict-export-declare-modifiers": false, "triple-equals": false, "unified-signatures": false From 0e3e3e4c81e5a57d5f0620ebe970c0cbc75e6a7f Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 12:20:55 +0900 Subject: [PATCH 19/22] cleanup lint error: triple-equals --- types/request/request-tests.ts | 6 +++--- types/request/tslint.json | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index ef47ebeb3d..8053f874ee 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -242,7 +242,7 @@ request // The following examples from https://github.com/request/request request('http://www.google.com', (error, response, body) => { - if (!error && response.statusCode == 200) { + if (!error && response.statusCode === 200) { console.log(body); // Show the HTML for the Google homepage. } }); @@ -427,7 +427,7 @@ options = { }; function callback(error: any, response: http.IncomingMessage, body: string) { - if (!error && response.statusCode == 200) { + if (!error && response.statusCode === 200) { var info = JSON.parse(body); console.log(info.stargazers_count + " Stars"); console.log(info.forks_count + " Forks"); @@ -614,7 +614,7 @@ var rand = Math.floor(Math.random() * 100000000).toString(); ] } , (error, response, body) => { - if (response.statusCode == 201) { + if (response.statusCode === 201) { console.log('document saved as: http://mikeal.iriscouch.com/testjs/' + rand); } else { console.log('error: ' + response.statusCode); diff --git a/types/request/tslint.json b/types/request/tslint.json index 26b488e3d9..8a08c7137a 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -12,7 +12,6 @@ "object-literal-shorthand": false, "prefer-const": false, "strict-export-declare-modifiers": false, - "triple-equals": false, "unified-signatures": false } } From fb7564f1c09130fc056318913ed54f727af4726a Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 12:22:26 +0900 Subject: [PATCH 20/22] cleanup lint error: no-consecutive-blank-lines --- types/request/request-tests.ts | 2 -- types/request/tslint.json | 1 - 2 files changed, 3 deletions(-) diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index 8053f874ee..761ef45ebb 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -48,7 +48,6 @@ var bodyArr: request.RequestPart[] = [{ defaultBodyRequest.put(); })(); - // --- --- --- --- --- --- --- --- --- --- --- --- obj = req.toJSON(); @@ -537,7 +536,6 @@ request.get({ } }); - request({ // will be ignored method: 'GET', diff --git a/types/request/tslint.json b/types/request/tslint.json index 8a08c7137a..b3f1287bb8 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -3,7 +3,6 @@ "rules": { "ban-types": false, "callable-types": false, - "no-consecutive-blank-lines": false, "no-duplicate-variable": false, "no-inferrable-types": false, "no-misused-new": false, From ee5526f8620930643294c9f5a08e4e5675a307c7 Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 12:25:29 +0900 Subject: [PATCH 21/22] cleanup lint error: callable-types --- types/request/index.d.ts | 4 +--- types/request/tslint.json | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/types/request/index.d.ts b/types/request/index.d.ts index 6162f92fd8..20ad40e64e 100644 --- a/types/request/index.d.ts +++ b/types/request/index.d.ts @@ -174,9 +174,7 @@ declare namespace request { export type OptionsWithUrl = UrlOptions & CoreOptions; export type Options = OptionsWithUri | OptionsWithUrl; - export interface RequestCallback { - (error: any, response: RequestResponse, body: any): void; - } + export type RequestCallback = (error: any, response: RequestResponse, body: any) => void; export type ResponseRequest = CoreOptions & { uri: Url; diff --git a/types/request/tslint.json b/types/request/tslint.json index b3f1287bb8..91824c6ac1 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -2,7 +2,6 @@ "extends": "dtslint/dt.json", "rules": { "ban-types": false, - "callable-types": false, "no-duplicate-variable": false, "no-inferrable-types": false, "no-misused-new": false, From fd1c81d5df844a54fffce582b754ba871b50a8e1 Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 30 Oct 2017 12:31:52 +0900 Subject: [PATCH 22/22] cleanup lint error: object-literal-key-quotes --- types/request/request-tests.ts | 22 +++++++++++----------- types/request/tslint.json | 1 - 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index 761ef45ebb..d2c308ed75 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -351,7 +351,7 @@ request({ data: [ { 'content-type': 'application/json', - body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) + body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, content_type: 'text/plain' }}}) }, { body: 'I am an attachment' } ] @@ -372,7 +372,7 @@ request({ multipart: [ { headers: { 'content-type': 'application/json' }, - body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) + body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, content_type: 'text/plain' }}}) }, { body: 'I am an attachment' }, { body: fs.createReadStream('image.png') } @@ -389,24 +389,24 @@ request({ request.get('http://some.server.com/').auth('username', 'password', false); // or request.get('http://some.server.com/', { - 'auth': { - 'user': 'username', - 'pass': 'password', - 'sendImmediately': false + auth: { + user: 'username', + pass: 'password', + sendImmediately: false } }); // or request.get('http://some.server.com/').auth('foo', 'bar', true, 'bearerToken'); // or request.get('http://some.server.com/', { - 'auth': { - 'bearer': 'bearerToken' + auth: { + bearer: 'bearerToken' } }); // or request.get('http://some.server.com/', { - 'auth': { - 'bearer': () => 'bearerToken' + auth: { + bearer: () => 'bearerToken' } }); @@ -606,7 +606,7 @@ var rand = Math.floor(Math.random() * 100000000).toString(); , uri: 'http://mikeal.iriscouch.com/testjs/' + rand , multipart: [ { headers: { 'content-type': 'application/json' } - , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) + , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, content_type: 'text/plain' }}}) } , { body: 'I am an attachment' } ] diff --git a/types/request/tslint.json b/types/request/tslint.json index 91824c6ac1..7f1cf14897 100644 --- a/types/request/tslint.json +++ b/types/request/tslint.json @@ -6,7 +6,6 @@ "no-inferrable-types": false, "no-misused-new": false, "no-var-keyword": false, - "object-literal-key-quotes": false, "object-literal-shorthand": false, "prefer-const": false, "strict-export-declare-modifiers": false,