Skip to content

Commit

Permalink
fixing eslint issues with types on modules etcd, redis, and test-suite
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredwray committed Aug 5, 2023
1 parent 1524a04 commit 809fac9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 20 deletions.
1 change: 0 additions & 1 deletion packages/etcd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
},
"homepage": "https://github.com/jaredwray/keyv",
"dependencies": {
"cockatiel": "^3.1.1",
"etcd3": "^1.1.0"
},
"devDependencies": {
Expand Down
15 changes: 1 addition & 14 deletions packages/etcd/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import {EventEmitter} from 'events';
import type {Lease} from 'etcd3';
import {Etcd3} from 'etcd3';
import {ExponentialBackoff, handleAll, retry} from 'cockatiel';
import {Etcd3, type Lease} from 'etcd3';
import type {StoredData} from 'keyv';
import type {ClearOutput, DeleteManyOutput, DeleteOutput, GetOutput, HasOutput, SetOutput} from './types';

Expand Down Expand Up @@ -46,19 +44,8 @@ class KeyvEtcd<Value = any> extends EventEmitter {

this.opts.url = this.opts.url!.replace(/^etcd:\/\//, '');

const policy = retry(handleAll, {backoff: new ExponentialBackoff()});
policy.onFailure(error => {
this.emit('error', error.reason);
});

this.client = new Etcd3({
hosts: this.opts.url,
faultHandling: {
// @ts-expect-error - iPolicy
host: () => policy,
// @ts-expect-error - iPolicy
global: policy,
},
});

// https://github.com/microsoft/etcd3/issues/105
Expand Down
5 changes: 2 additions & 3 deletions packages/redis/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type{StoredData} from 'keyv';
import {type Cluster} from 'ioredis';
import type Redis from 'ioredis';
import type {StoredData} from 'keyv';
import {type Redis, type Cluster} from 'ioredis';

export type KeyvRedisOptions = {
[K in keyof Redis]?: Redis[K];
Expand Down
3 changes: 1 addition & 2 deletions packages/test-suite/src/values.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {Buffer} from 'buffer';
import type {TestFn} from 'ava';
import type KeyvModule from 'keyv';
import type bigNumber from 'bignumber.js';
import JSONbig from 'json-bigint';
import {BigNumber} from 'bignumber.js';
import type {KeyvStoreFn} from './types';
Expand Down Expand Up @@ -88,7 +87,7 @@ const keyvValueTests = (test: TestFn, Keyv: typeof KeyvModule, store: KeyvStoreF
const keyv = new Keyv({store: store(),
serialize: JSONbig.stringify,
deserialize: JSONbig.parse});
const value = BigInt('9223372036854775807') as unknown as bigNumber.Value;
const value = BigInt('9223372036854775807') as unknown as BigNumber.Value;
await keyv.set('foo', value);
// eslint-disable-next-line new-cap
t.deepEqual(await keyv.get('foo'), BigNumber(value));
Expand Down

0 comments on commit 809fac9

Please sign in to comment.