Skip to content

Commit cd3d088

Browse files
committed
Add "prettier" config
1 parent 941efab commit cd3d088

20 files changed

Lines changed: 130 additions & 122 deletions

File tree

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
packages/*/dist
2+
packages/degenerator/test/*

.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
"lint": "turbo run lint",
77
"test": "turbo run test",
88
"test-e2e": "turbo run test-e2e",
9-
"format": "prettier --write \"**/*.{ts,tsx,md}\""
9+
"format": "prettier --write \"**/*.{ts,js}\""
1010
},
1111
"devDependencies": {
1212
"@typescript-eslint/eslint-plugin": "^5.59.1",
1313
"@typescript-eslint/parser": "^5.59.1",
1414
"eslint": "^7.32.0",
1515
"eslint-config-prettier": "^8.8.0",
1616
"eslint-config-turbo": "^1.9.3",
17-
"prettier": "^2.5.1",
17+
"prettier": "^2.8.8",
1818
"turbo": "latest"
1919
}
2020
}

packages/agent-base/src/helpers.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
import * as http from "http";
2-
import * as https from "https";
3-
import type { Readable } from "stream";
1+
import * as http from 'http';
2+
import * as https from 'https';
3+
import type { Readable } from 'stream';
44

55
export async function toBuffer(stream: Readable): Promise<Buffer> {
6-
let length = 0;
7-
const chunks: Buffer[] = [];
8-
for await (const chunk of stream) {
9-
length += chunk.length;
10-
chunks.push(chunk);
11-
}
12-
return Buffer.concat(chunks, length);
6+
let length = 0;
7+
const chunks: Buffer[] = [];
8+
for await (const chunk of stream) {
9+
length += chunk.length;
10+
chunks.push(chunk);
11+
}
12+
return Buffer.concat(chunks, length);
1313
}
1414

1515
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1616
export async function json(stream: Readable): Promise<any> {
17-
const buf = await toBuffer(stream);
18-
return JSON.parse(buf.toString('utf8'));
17+
const buf = await toBuffer(stream);
18+
return JSON.parse(buf.toString('utf8'));
1919
}
2020

2121
export function req(
2222
url: string | URL,
2323
opts: https.RequestOptions = {}
2424
): Promise<http.IncomingMessage> {
2525
return new Promise((resolve, reject) => {
26-
const href = typeof url === 'string' ? url : url.href;
27-
(href.startsWith("https:") ? https : http)
26+
const href = typeof url === 'string' ? url : url.href;
27+
(href.startsWith('https:') ? https : http)
2828
.request(url, opts, resolve)
29-
.once("error", reject)
29+
.once('error', reject)
3030
.end();
3131
});
32-
}
32+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */
22
module.exports = {
3-
preset: 'ts-jest',
4-
testEnvironment: 'node',
3+
preset: 'ts-jest',
4+
testEnvironment: 'node',
55
};
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */
22
module.exports = {
3-
preset: 'ts-jest',
4-
testEnvironment: 'node',
3+
preset: 'ts-jest',
4+
testEnvironment: 'node',
55
};

packages/get-uri/jest.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @type {import('ts-jest').JestConfigWithTsJest} */
22
module.exports = {
3-
preset: 'ts-jest',
4-
testEnvironment: 'node',
3+
preset: 'ts-jest',
4+
testEnvironment: 'node',
55
};

packages/get-uri/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ export const protocols = {
2626
export type Protocols = typeof protocols;
2727

2828
export type ProtocolsOptions = {
29-
[P in keyof Protocols]: NonNullable<Parameters<Protocols[P]>[1]>
30-
}
29+
[P in keyof Protocols]: NonNullable<Parameters<Protocols[P]>[1]>;
30+
};
3131

3232
export type ProtocolOpts<T> = {
3333
[P in keyof ProtocolsOptions]: Protocol<T> extends P

packages/http-proxy-agent/src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type Protocol<T> = T extends `${infer Protocol}:${infer _}` ? Protocol : never;
1313
type ConnectOptsMap = {
1414
http: Omit<net.TcpNetConnectOpts, 'host' | 'port'>;
1515
https: Omit<tls.ConnectionOptions, 'host' | 'port'>;
16-
}
16+
};
1717

1818
export type HttpProxyAgentOptions<T> = {
1919
[P in keyof ConnectOptsMap]: Protocol<T> extends P
@@ -53,7 +53,10 @@ export class HttpProxyAgent<Uri extends string> extends Agent {
5353
debug('Creating new HttpProxyAgent instance: %o', this.proxy.href);
5454

5555
// Trim off the brackets from IPv6 addresses
56-
const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, '');
56+
const host = (this.proxy.hostname || this.proxy.host).replace(
57+
/^\[|\]$/g,
58+
''
59+
);
5760
const port = this.proxy.port
5861
? parseInt(this.proxy.port, 10)
5962
: this.secureProxy

packages/http-proxy-agent/test/test.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ describe('HttpProxyAgent', () => {
105105
assert.equal(false, agent.secureProxy);
106106
});
107107
it('should be `true` when "https:" protocol is used', () => {
108-
let agent = new HttpProxyAgent(`https://127.0.0.1:${proxyPort}`);
108+
let agent = new HttpProxyAgent(
109+
`https://127.0.0.1:${proxyPort}`
110+
);
109111
assert.equal(true, agent.secureProxy);
110112
});
111113
});
@@ -200,7 +202,7 @@ describe('HttpProxyAgent', () => {
200202
});
201203
it('should receive the 407 authorization code on the `http.ClientResponse`', (done) => {
202204
// reject all requests
203-
proxy.authenticate = () => false
205+
proxy.authenticate = () => false;
204206

205207
let proxyUri = `http://127.0.0.1:${proxyPort}`;
206208
let agent = new HttpProxyAgent(proxyUri);
@@ -222,7 +224,9 @@ describe('HttpProxyAgent', () => {
222224
// set a proxy authentication function for this test
223225
proxy.authenticate = (req) => {
224226
// username:password is "foo:bar"
225-
return req.headers['proxy-authorization'] === 'Basic Zm9vOmJhcg=='
227+
return (
228+
req.headers['proxy-authorization'] === 'Basic Zm9vOmJhcg=='
229+
);
226230
};
227231

228232
// set HTTP "request" event handler for this test

0 commit comments

Comments
 (0)