Skip to content

Commit 15b82cd

Browse files
committed
fix: missing linting after rebasing from main
1 parent dd74dcb commit 15b82cd

4 files changed

Lines changed: 23 additions & 18 deletions

File tree

src/repository/bootstrap-provider.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { promises } from 'fs';
2-
import { ClientFeaturesResponse, FeatureInterface } from '../feature';
3-
import { CustomHeaders } from '../headers';
4-
import { buildHeaders, getDefaultAgent } from '../request';
1+
import { promises } from 'node:fs';
2+
import type { ClientFeaturesResponse, FeatureInterface } from '../feature';
3+
import type { CustomHeaders } from '../headers';
54
import { getKyClient } from '../http-client';
6-
import { Segment } from '../strategy/strategy';
5+
import { buildHeaders, getDefaultAgent } from '../request';
6+
import type { Segment } from '../strategy/strategy';
77

88
export interface BootstrapProvider {
99
readBootstrap(): Promise<ClientFeaturesResponse | undefined>;
@@ -55,8 +55,9 @@ export class DefaultBootstrapProvider implements BootstrapProvider {
5555
contentType: undefined,
5656
custom: this.urlHeaders,
5757
}),
58+
// @ts-expect-error passed on to fetch
5859
agent: getDefaultAgent,
59-
} as any);
60+
});
6061
if (response.ok) {
6162
return response.json();
6263
}

src/repository/polling-fetcher.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { EventEmitter } from 'events';
1+
import { EventEmitter } from 'node:events';
2+
import { UnleashEvents } from '../events';
23
import { parseClientFeaturesDelta } from '../feature';
34
import { get } from '../request';
45
import type { TagFilter } from '../tags';

src/request.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
import * as http from 'node:http';
2+
import * as https from 'node:https';
3+
import type { URL } from 'node:url';
14
import { HttpProxyAgent } from 'http-proxy-agent';
25
import { HttpsProxyAgent } from 'https-proxy-agent';
3-
import * as http from 'http';
4-
import * as https from 'https';
5-
import { URL } from 'url';
66
import { getProxyForUrl } from 'proxy-from-env';
7-
import { CustomHeaders } from './headers';
8-
import { HttpOptions } from './http-options';
7+
import type { CustomHeaders } from './headers';
98
import { defaultRetry, getKyClient } from './http-client';
9+
import type { HttpOptions } from './http-options';
10+
1011
const details = require('./details.json');
1112

1213
export interface RequestOptions {
@@ -161,7 +162,7 @@ export const post = async ({
161162
retry: defaultRetry,
162163
} as const;
163164

164-
return ky.post(url, requestOptions as any).catch((err: any) => {
165+
return ky.post(url, requestOptions).catch((err) => {
165166
if (err?.response) {
166167
return err.response;
167168
}
@@ -198,8 +199,10 @@ export const get = async ({
198199
retry: defaultRetry,
199200
} as const;
200201

201-
return ky.get(url, requestOptions as any).catch((err: any) => {
202+
return ky.get(url, requestOptions).catch((err: unknown) => {
203+
// @ts-expect-error we declare as unknown, so won't have the type here
202204
if (err?.response) {
205+
// @ts-expect-error we declare as unknown, so won't have the type here
203206
return err.response;
204207
}
205208
throw err;

src/test/repository/repository.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ test('bootstrap should not override load backup-file', async () => {
10201020
expect(repo.getToggle('feature-backup')?.enabled).toEqual(true);
10211021
});
10221022

1023-
test('Failing twice then succeeding should shrink interval to 2x initial (404)', async (t) => {
1023+
test('Failing twice then succeeding should shrink interval to 2x initial (404)', async (_t) => {
10241024
const url = 'http://unleash-test-fail5times.app';
10251025
nock(url).get('/client/features').times(2).reply(404);
10261026
const repo = new Repository({
@@ -1067,7 +1067,7 @@ test('Failing twice then succeeding should shrink interval to 2x initial (404)',
10671067

10681068
// Skipped because the HTTP client automatically retries 429 responses,
10691069
// which makes the test very slow.
1070-
test.skip('Failing twice should increase interval to initial + 2x interval (429)', async (t) => {
1070+
test.skip('Failing twice should increase interval to initial + 2x interval (429)', async (_t) => {
10711071
const url = 'http://unleash-test-fail5times.app';
10721072
nock(url).persist().get('/client/features').reply(429);
10731073
const repo = new Repository({
@@ -1086,12 +1086,12 @@ test.skip('Failing twice should increase interval to initial + 2x interval (429)
10861086
await repo.fetch();
10871087
expect(2).toEqual(repo.getFailures());
10881088
expect(30).toEqual(repo.nextFetch());
1089-
repo.stop()
1089+
repo.stop();
10901090
});
10911091

10921092
// Skipped because the HTTP client automatically retries 429 responses,
10931093
// which makes the test very slow.
1094-
test.skip('Failing twice then succeeding should shrink interval to 2x initial (429)', async (t) => {
1094+
test.skip('Failing twice then succeeding should shrink interval to 2x initial (429)', async (_t) => {
10951095
const url = 'http://unleash-test-fail5times.app';
10961096
nock(url).persist().get('/client/features').reply(429);
10971097
const repo = new Repository({

0 commit comments

Comments
 (0)