From 3a84454208e39aae7f2bae0bf68b7ede2872f317 Mon Sep 17 00:00:00 2001 From: Szymon Marczak <36894700+szmarczak@users.noreply.github.com> Date: Fri, 22 Oct 2021 14:05:15 +0200 Subject: [PATCH] Upgrade dependencies --- benchmark/index.ts | 1 + package.json | 40 +++++++++++---------- source/core/errors.ts | 1 + source/core/index.ts | 1 + source/core/options.ts | 2 ++ source/core/utils/options-to-url.ts | 1 + source/types.ts | 2 ++ test/cache.ts | 16 ++++----- test/error.ts | 1 + test/helpers/create-https-test-server.ts | 14 ++++---- test/http.ts | 2 ++ test/https.ts | 44 ++++++++++++------------ test/url-to-options.ts | 9 ++--- 13 files changed, 74 insertions(+), 60 deletions(-) diff --git a/benchmark/index.ts b/benchmark/index.ts index 01f1224eb..2e059800d 100644 --- a/benchmark/index.ts +++ b/benchmark/index.ts @@ -32,6 +32,7 @@ const gotOptions: OptionsInit & {isStream?: true} = { const normalizedGotOptions = new Options(url, gotOptions); const requestOptions = { + // eslint-disable-next-line @typescript-eslint/naming-convention strictSSL: false, agent: httpsAgent, }; diff --git a/package.json b/package.json index 9f6269956..d3929fe6d 100644 --- a/package.json +++ b/package.json @@ -44,36 +44,37 @@ "ky" ], "dependencies": { - "@sindresorhus/is": "^4.0.1", + "@sindresorhus/is": "^4.2.0", "@szmarczak/http-timer": "^5.0.1", "@types/cacheable-request": "^6.0.2", "@types/responselike": "^1.0.0", - "cacheable-lookup": "^6.0.1", + "cacheable-lookup": "^6.0.4", "cacheable-request": "^7.0.2", - "decompress-response": "^6.0.0", - "form-data-encoder": "^1.5.1", + "decompress-response": "^7.0.0", + "form-data-encoder": "^1.6.0", "get-stream": "^6.0.1", - "http2-wrapper": "^2.1.4", - "lowercase-keys": "^2.0.0", + "http2-wrapper": "^2.1.9", + "lowercase-keys": "^3.0.0", "p-cancelable": "^3.0.0", "responselike": "^2.0.0" }, "devDependencies": { "@hapi/bourne": "^2.0.0", "@sindresorhus/tsconfig": "^2.0.0", - "@sinonjs/fake-timers": "^7.1.2", + "@sinonjs/fake-timers": "^8.0.1", "@types/benchmark": "^2.1.1", "@types/express": "^4.17.13", - "@types/node": "^16.7.2", - "@types/node-fetch": "^2.5.12", + "@types/node": "^16.11.3", + "@types/node-fetch": "^3.0.3", "@types/pem": "^1.9.6", "@types/pify": "^5.0.1", "@types/readable-stream": "^2.3.11", "@types/request": "^2.48.7", - "@types/sinon": "^10.0.2", + "@types/sinon": "^10.0.4", + "@types/sinonjs__fake-timers": "^6.0.4", "@types/tough-cookie": "^4.0.1", "ava": "^3.15.0", - "axios": "^0.21.1", + "axios": "^0.23.0", "benchmark": "^2.1.4", "bluebird": "^3.7.2", "body-parser": "^1.19.0", @@ -83,9 +84,9 @@ "delay": "^5.0.0", "express": "^4.17.1", "form-data": "^4.0.0", - "formdata-node": "^4.0.1", - "nock": "^13.1.3", - "node-fetch": "^2.6.1", + "formdata-node": "^4.3.1", + "nock": "^13.1.4", + "node-fetch": "^2.6.5", "np": "^7.5.0", "nyc": "^15.1.0", "p-event": "^4.2.0", @@ -96,12 +97,12 @@ "sinon": "^11.1.2", "slow-stream": "0.0.4", "tempy": "^2.0.0", - "then-busboy": "^5.1.0", + "then-busboy": "^5.1.1", "to-readable-stream": "^3.0.0", "tough-cookie": "^4.0.0", - "ts-node": "^10.2.1", - "typescript": "4.4.2", - "xo": "^0.44.0" + "ts-node": "^10.3.1", + "typescript": "4.4.4", + "xo": "^0.45.0" }, "types": "dist/source", "sideEffects": false, @@ -150,7 +151,8 @@ "@typescript-eslint/no-unsafe-return": "off", "@typescript-eslint/no-unsafe-assignment": "off", "@typescript-eslint/no-unsafe-call": "off", - "@typescript-eslint/await-thenable": "off" + "@typescript-eslint/await-thenable": "off", + "no-lone-blocks": "off" } }, "runkitExampleFilename": "./documentation/examples/runkit-example.js" diff --git a/source/core/errors.ts b/source/core/errors.ts index 5ea110e09..fc48166f2 100644 --- a/source/core/errors.ts +++ b/source/core/errors.ts @@ -88,6 +88,7 @@ export class MaxRedirectsError extends RequestError { An error to be thrown when the server response code is not 2xx nor 3xx if `options.followRedirect` is `true`, but always except for 304. Includes a `response` property. */ +// eslint-disable-next-line @typescript-eslint/naming-convention export class HTTPError extends RequestError { declare readonly response: Response; declare readonly request: Request; diff --git a/source/core/index.ts b/source/core/index.ts index 10c59ada3..cd8d2c6f3 100644 --- a/source/core/index.ts +++ b/source/core/index.ts @@ -571,6 +571,7 @@ export default class Request extends Duplex implements RequestEvents { const {headers} = options; const isForm = !is.undefined(options.form); + // eslint-disable-next-line @typescript-eslint/naming-convention const isJSON = !is.undefined(options.json); const isBody = !is.undefined(options.body); const cannotHaveBody = methodsWithoutBody.has(options.method) && !(options.method === 'GET' && options.allowGetBody); diff --git a/source/core/options.ts b/source/core/options.ts index 356b079d9..8a40c6c66 100644 --- a/source/core/options.ts +++ b/source/core/options.ts @@ -2233,6 +2233,7 @@ export default class Options { this._internals.maxHeaderSize = value; } + // eslint-disable-next-line @typescript-eslint/naming-convention toJSON() { return {...this._internals}; } @@ -2267,6 +2268,7 @@ export default class Options { ...this._unixOptions, // HTTPS options + // eslint-disable-next-line @typescript-eslint/naming-convention ALPNProtocols: https.alpnProtocols, ca: https.certificateAuthority, cert: https.certificate, diff --git a/source/core/utils/options-to-url.ts b/source/core/utils/options-to-url.ts index 3a2273537..c56969c62 100644 --- a/source/core/utils/options-to-url.ts +++ b/source/core/utils/options-to-url.ts @@ -1,6 +1,7 @@ /* istanbul ignore file: deprecated */ import {URL} from 'node:url'; +// eslint-disable-next-line @typescript-eslint/naming-convention export interface URLOptions { href?: string; protocol?: string; diff --git a/source/types.ts b/source/types.ts index 827c7acfe..5a865b9b0 100644 --- a/source/types.ts +++ b/source/types.ts @@ -71,6 +71,7 @@ export interface ExtendOptions extends OptionsInit { } export type OptionsOfTextResponseBody = Merge; +// eslint-disable-next-line @typescript-eslint/naming-convention export type OptionsOfJSONResponseBody = Merge; export type OptionsOfBufferResponseBody = Merge; export type OptionsOfUnknownResponseBody = Merge; @@ -176,6 +177,7 @@ export interface GotRequestFunction { /** All available HTTP request methods provided by Got. */ +// eslint-disable-next-line @typescript-eslint/naming-convention export type HTTPAlias = | 'get' | 'post' diff --git a/test/cache.ts b/test/cache.ts index a53b10125..b83fb62f4 100644 --- a/test/cache.ts +++ b/test/cache.ts @@ -88,16 +88,16 @@ test('redirects are cached and re-used internally', withServer, async (t, server server.get('/', cacheEndpoint); const cache = new Map(); - const A1 = await got('301', {cache}); - const B1 = await got('302', {cache}); + const a1 = await got('301', {cache}); + const b1 = await got('302', {cache}); - const A2 = await got('301', {cache}); - const B2 = await got('302', {cache}); + const a2 = await got('301', {cache}); + const b2 = await got('302', {cache}); t.is(cache.size, 3); - t.is(A1.body, B1.body); - t.is(A1.body, A2.body); - t.is(B1.body, B2.body); + t.is(a1.body, b1.body); + t.is(a1.body, a2.body); + t.is(b1.body, b2.body); }); test('cached response has got options', withServer, async (t, server, got) => { @@ -327,7 +327,7 @@ test('cached response ETag', withServer, async (t, server, got) => { response.writeHead(304); response.end(); } else { - response.writeHead(200, {ETag: etag}); + response.writeHead(200, {etag}); response.end(body); } }); diff --git a/test/error.ts b/test/error.ts index 591dd7105..cd76968e9 100644 --- a/test/error.ts +++ b/test/error.ts @@ -314,6 +314,7 @@ test.skip('the old stacktrace is recovered', async t => { }); test.serial('custom stack trace', withServer, async (t, _server, got) => { + // eslint-disable-next-line @typescript-eslint/naming-convention const ErrorCaptureStackTrace = Error.captureStackTrace; const enable = () => { diff --git a/test/helpers/create-https-test-server.ts b/test/helpers/create-https-test-server.ts index c26a76bf6..1fa52c786 100644 --- a/test/helpers/create-https-test-server.ts +++ b/test/helpers/create-https-test-server.ts @@ -25,22 +25,22 @@ export interface ExtendedHttpsTestServer extends express.Express { } const createHttpsTestServer = async (options: HttpsServerOptions = {}): Promise => { - const createCSR = pify(pem.createCSR); + const createCsr = pify(pem.createCSR); const createCertificate = pify(pem.createCertificate); - const caCSRResult = await createCSR({commonName: 'authority'}); + const caCsrResult = await createCsr({commonName: 'authority'}); const caResult = await createCertificate({ - csr: caCSRResult.csr, - clientKey: caCSRResult.clientKey, + csr: caCsrResult.csr, + clientKey: caCsrResult.clientKey, selfSigned: true, }); const caKey = caResult.clientKey; const caCert = caResult.certificate; - const serverCSRResult = await createCSR({commonName: options.commonName ?? 'localhost'}); + const serverCsrResult = await createCsr({commonName: options.commonName ?? 'localhost'}); const serverResult = await createCertificate({ - csr: serverCSRResult.csr, - clientKey: serverCSRResult.clientKey, + csr: serverCsrResult.csr, + clientKey: serverCsrResult.clientKey, serviceKey: caKey, serviceCertificate: caCert, days: options.days ?? 365, diff --git a/test/http.ts b/test/http.ts index 8a91af2b5..0d757cd1b 100644 --- a/test/http.ts +++ b/test/http.ts @@ -11,8 +11,10 @@ import pEvent from 'p-event'; import got, {HTTPError, ReadError, RequestError} from '../source/index.js'; import withServer from './helpers/with-server.js'; +// eslint-disable-next-line @typescript-eslint/naming-convention const IPv6supported = Object.values(os.networkInterfaces()).some(iface => iface?.some(addr => !addr.internal && addr.family === 'IPv6')); +// eslint-disable-next-line @typescript-eslint/naming-convention const testIPv6 = (IPv6supported && process.env.TRAVIS_DIST !== 'bionic' && process.env.TRAVIS_DIST !== 'focal') ? test : test.skip; const echoIp: Handler = (request, response) => { diff --git a/test/https.ts b/test/https.ts index 07cf23632..0de8f9d06 100644 --- a/test/https.ts +++ b/test/https.ts @@ -8,7 +8,7 @@ import got from '../source/index.js'; import {withHttpsServer} from './helpers/with-server.js'; const createPrivateKey = pify(pem.createPrivateKey); -const createCSR = pify(pem.createCSR); +const createCsr = pify(pem.createCSR); const createCertificate = pify(pem.createCertificate); const createPkcs12 = pify(pem.createPkcs12); @@ -205,10 +205,10 @@ test('client certificate', withHttpsServer(), async (t, server, got) => { }); }); - const clientCSRResult = await createCSR({commonName: 'client'}); + const clientCsrResult = await createCsr({commonName: 'client'}); const clientResult = await createCertificate({ - csr: clientCSRResult.csr, - clientKey: clientCSRResult.clientKey, + csr: clientCsrResult.csr, + clientKey: clientCsrResult.clientKey, serviceKey: (server as any).caKey, serviceCertificate: (server as any).caCert, }); @@ -245,10 +245,10 @@ test('invalid client certificate (self-signed)', withHttpsServer(), async (t, se }); }); - const clientCSRResult = await createCSR({commonName: 'other-client'}); + const clientCsrResult = await createCsr({commonName: 'other-client'}); const clientResult = await createCertificate({ - csr: clientCSRResult.csr, - clientKey: clientCSRResult.clientKey, + csr: clientCsrResult.csr, + clientKey: clientCsrResult.clientKey, selfSigned: true, }); // eslint-disable-next-line prefer-destructuring @@ -277,19 +277,19 @@ test('invalid client certificate (other CA)', withHttpsServer(), async (t, serve }); }); - const caCSRResult = await createCSR({commonName: 'other-authority'}); + const caCsrResult = await createCsr({commonName: 'other-authority'}); const caResult = await createCertificate({ - csr: caCSRResult.csr, - clientKey: caCSRResult.clientKey, + csr: caCsrResult.csr, + clientKey: caCsrResult.clientKey, selfSigned: true, }); const caKey = caResult.clientKey; const caCert = caResult.certificate; - const clientCSRResult = await createCSR({commonName: 'other-client'}); + const clientCsrResult = await createCsr({commonName: 'other-client'}); const clientResult = await createCertificate({ - csr: clientCSRResult.csr, - clientKey: clientCSRResult.clientKey, + csr: clientCsrResult.csr, + clientKey: clientCsrResult.clientKey, serviceKey: caKey, serviceCertificate: caCert, }); @@ -336,15 +336,15 @@ test('key passphrase', withHttpsServer(), async (t, server, got) => { cipher: 'aes256', password: 'randomPassword', }); - const clientCSRResult = await createCSR({ + const clientCsrResult = await createCsr({ // eslint-disable-next-line object-shorthand clientKey: clientKey, clientKeyPassword: 'randomPassword', commonName: 'client', }); const clientResult = await createCertificate({ - csr: clientCSRResult.csr, - clientKey: clientCSRResult.clientKey, + csr: clientCsrResult.csr, + clientKey: clientCsrResult.clientKey, clientKeyPassword: 'randomPassword', serviceKey: (server as any).caKey, serviceCertificate: (server as any).caCert, @@ -391,15 +391,15 @@ test('invalid key passphrase', withHttpsServer(), async (t, server, got) => { cipher: 'aes256', password: 'randomPassword', }); - const clientCSRResult = await createCSR({ + const clientCsrResult = await createCsr({ // eslint-disable-next-line object-shorthand clientKey: clientKey, clientKeyPassword: 'randomPassword', commonName: 'client', }); const clientResult = await createCertificate({ - csr: clientCSRResult.csr, - clientKey: clientCSRResult.clientKey, + csr: clientCsrResult.csr, + clientKey: clientCsrResult.clientKey, clientKeyPassword: 'randomPassword', serviceKey: (server as any).caKey, serviceCertificate: (server as any).caCert, @@ -430,10 +430,10 @@ test('client certificate PFX', withHttpsServer(), async (t, server, got) => { }); }); - const clientCSRResult = await createCSR({commonName: 'client'}); + const clientCsrResult = await createCsr({commonName: 'client'}); const clientResult = await createCertificate({ - csr: clientCSRResult.csr, - clientKey: clientCSRResult.clientKey, + csr: clientCsrResult.csr, + clientKey: clientCsrResult.clientKey, serviceKey: (server as any).caKey, serviceCertificate: (server as any).caCert, }); diff --git a/test/url-to-options.ts b/test/url-to-options.ts index e268753c0..cffe9623c 100644 --- a/test/url-to-options.ts +++ b/test/url-to-options.ts @@ -41,8 +41,9 @@ test('converts URL to options', t => { }); test('converts IPv6 URL to options', t => { - const IPv6URL = 'https://[2001:cdba::3257:9652]:443/'; - const parsedUrl = new URL(IPv6URL); + // eslint-disable-next-line @typescript-eslint/naming-convention + const IPv6Url = 'https://[2001:cdba::3257:9652]:443/'; + const parsedUrl = new URL(IPv6Url); const options = urlToOptions(parsedUrl); const expected = { hash: '', @@ -59,8 +60,8 @@ test('converts IPv6 URL to options', t => { }); test('only adds port to options for URLs with ports', t => { - const noPortURL = 'https://github.com/'; - const parsedUrl = new URL(noPortURL); + const noPortUrl = 'https://github.com/'; + const parsedUrl = new URL(noPortUrl); const options = urlToOptions(parsedUrl); const expected = { hash: '',