Skip to content

Commit c7aad2d

Browse files
lint: Remove unused imports and fix linting (#356)
* fix: Don't wrap HubSpotHTTPError * fix: Use axios instances * lint: Fix linting + Prettier
1 parent a62daf7 commit c7aad2d

File tree

2 files changed

+40
-20
lines changed

2 files changed

+40
-20
lines changed

http/__tests__/getAxiosConfig.test.ts

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ describe('http/getAxiosConfig', () => {
5353
describe('hostnameMatchesNoProxyPattern', () => {
5454
it('matches exact hostname', () => {
5555
expect(hostnameMatchesNoProxyPattern('localhost', 'localhost')).toBe(true);
56-
expect(hostnameMatchesNoProxyPattern('api.hubapi.com', 'api.hubapi.com')).toBe(true);
56+
expect(
57+
hostnameMatchesNoProxyPattern('api.hubapi.com', 'api.hubapi.com')
58+
).toBe(true);
5759
});
5860

5961
it('matches wildcard *', () => {
@@ -62,30 +64,54 @@ describe('hostnameMatchesNoProxyPattern', () => {
6264
});
6365

6466
it('matches domain suffix with leading dot', () => {
65-
expect(hostnameMatchesNoProxyPattern('api.hubapi.com', '.hubapi.com')).toBe(true);
66-
expect(hostnameMatchesNoProxyPattern('foo.bar.hubapi.com', '.hubapi.com')).toBe(true);
67-
expect(hostnameMatchesNoProxyPattern('hubapi.com', '.hubapi.com')).toBe(false);
67+
expect(hostnameMatchesNoProxyPattern('api.hubapi.com', '.hubapi.com')).toBe(
68+
true
69+
);
70+
expect(
71+
hostnameMatchesNoProxyPattern('foo.bar.hubapi.com', '.hubapi.com')
72+
).toBe(true);
73+
expect(hostnameMatchesNoProxyPattern('hubapi.com', '.hubapi.com')).toBe(
74+
false
75+
);
6876
});
6977

7078
it('matches domain suffix without leading dot', () => {
71-
expect(hostnameMatchesNoProxyPattern('api.hubapi.com', 'hubapi.com')).toBe(true);
72-
expect(hostnameMatchesNoProxyPattern('hubapi.com', 'hubapi.com')).toBe(true);
73-
expect(hostnameMatchesNoProxyPattern('foo.bar.hubapi.com', 'hubapi.com')).toBe(true);
79+
expect(hostnameMatchesNoProxyPattern('api.hubapi.com', 'hubapi.com')).toBe(
80+
true
81+
);
82+
expect(hostnameMatchesNoProxyPattern('hubapi.com', 'hubapi.com')).toBe(
83+
true
84+
);
85+
expect(
86+
hostnameMatchesNoProxyPattern('foo.bar.hubapi.com', 'hubapi.com')
87+
).toBe(true);
7488
});
7589

7690
it('does not match partial hostnames', () => {
77-
expect(hostnameMatchesNoProxyPattern('nothubapi.com', 'hubapi.com')).toBe(false);
78-
expect(hostnameMatchesNoProxyPattern('api.nothubapi.com', 'hubapi.com')).toBe(false);
91+
expect(hostnameMatchesNoProxyPattern('nothubapi.com', 'hubapi.com')).toBe(
92+
false
93+
);
94+
expect(
95+
hostnameMatchesNoProxyPattern('api.nothubapi.com', 'hubapi.com')
96+
).toBe(false);
7997
});
8098

8199
it('is case insensitive', () => {
82-
expect(hostnameMatchesNoProxyPattern('API.HUBAPI.COM', 'hubapi.com')).toBe(true);
83-
expect(hostnameMatchesNoProxyPattern('api.hubapi.com', 'HUBAPI.COM')).toBe(true);
100+
expect(hostnameMatchesNoProxyPattern('API.HUBAPI.COM', 'hubapi.com')).toBe(
101+
true
102+
);
103+
expect(hostnameMatchesNoProxyPattern('api.hubapi.com', 'HUBAPI.COM')).toBe(
104+
true
105+
);
84106
});
85107

86108
it('trims whitespace from pattern', () => {
87-
expect(hostnameMatchesNoProxyPattern('localhost', ' localhost ')).toBe(true);
88-
expect(hostnameMatchesNoProxyPattern('api.hubapi.com', ' .hubapi.com ')).toBe(true);
109+
expect(hostnameMatchesNoProxyPattern('localhost', ' localhost ')).toBe(
110+
true
111+
);
112+
expect(
113+
hostnameMatchesNoProxyPattern('api.hubapi.com', ' .hubapi.com ')
114+
).toBe(true);
89115
});
90116
});
91117

http/index.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import path from 'path';
22
import fs from 'fs-extra';
33
import contentDisposition from 'content-disposition';
4-
import {
5-
AxiosRequestConfig,
6-
AxiosResponse,
7-
AxiosPromise,
8-
isAxiosError,
9-
} from 'axios';
4+
import { AxiosRequestConfig, AxiosResponse, AxiosPromise } from 'axios';
105

116
import { getConfigAccountById } from '../config';
127
import { USER_AGENTS, getAxiosConfig } from './getAxiosConfig';
@@ -16,7 +11,6 @@ import { getOauthManager } from '../lib/oauth';
1611
import { HttpOptions, HubSpotPromise } from '../types/Http';
1712
import { logger } from '../lib/logger';
1813
import { i18n } from '../utils/lang';
19-
import { HubSpotHttpError } from '../models/HubSpotHttpError';
2014
import { OAuthConfigAccount } from '../types/Accounts';
2115
import {
2216
PERSONAL_ACCESS_KEY_AUTH_METHOD,

0 commit comments

Comments
 (0)