Skip to content

Commit

Permalink
Remove some eslint overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
jacogr committed Jun 17, 2023
1 parent 9913701 commit 257ffe2
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
4 changes: 1 addition & 3 deletions packages/api-contract/src/checkTypes.manual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@ async function main (): Promise<void> {
});
const pairs = createTestPairs();

// eslint-disable-next-line @typescript-eslint/no-floating-promises
Promise.all([
await Promise.all([
checkBlueprint(api, pairs),
checkContract(api, pairs)
]);
}

// eslint-disable-next-line @typescript-eslint/unbound-method
main().catch(console.error);
9 changes: 6 additions & 3 deletions packages/api/src/base/Init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
// 'connected' event, then the `on('connected')` won't fire anymore. To
// cater for this case, we call manually `this._onProviderConnect`.
if (this._rpcCore.provider.isConnected) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.#onProviderConnect();
this.#onProviderConnect().catch(() => {
// swallow
});
}
}

Expand Down Expand Up @@ -378,7 +379,9 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
// Only enable the health keepalive on WS, not needed on HTTP
this.#healthTimer = this.hasSubscriptions
? setInterval((): void => {
firstValueFrom(this._rpcCore.system.health.raw()).catch(() => undefined);
firstValueFrom(this._rpcCore.system.health.raw()).catch(() => {
// swallow
});
}, KEEPALIVE_INTERVAL)
: null;
}
Expand Down
5 changes: 1 addition & 4 deletions packages/api/src/checkTypes.manual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ async function tx (api: ApiPromise, pairs: TestKeyringMapSubstrate): Promise<voi
// it allows for query & then using the submittable
const second = api.tx.democracy.second(123);

// eslint-disable-next-line @typescript-eslint/no-floating-promises
await second.signAndSend('123', (result) => console.log(result));

// it handles enum inputs correctly
Expand Down Expand Up @@ -305,8 +304,7 @@ async function main (): Promise<void> {
const api = await ApiPromise.create();
const pairs = createTestPairs();

// eslint-disable-next-line @typescript-eslint/no-floating-promises
Promise.all([
await Promise.all([
calls(api),
consts(api),
derive(api),
Expand All @@ -322,5 +320,4 @@ async function main (): Promise<void> {
]);
}

// eslint-disable-next-line @typescript-eslint/unbound-method
main().catch(console.error);
10 changes: 6 additions & 4 deletions packages/api/src/promise/Combinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ export class Combinator<T extends unknown[] = unknown[]> {
}

try {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.#callback(this.#results as T);
Promise
.resolve(this.#callback(this.#results as T))
.catch(() => {
// swallow
});
} catch {
// swallow, we don't want the handler to trip us up
}
Expand All @@ -74,8 +77,7 @@ export class Combinator<T extends unknown[] = unknown[]> {

this.#isActive = false;

// eslint-disable-next-line @typescript-eslint/no-misused-promises
this.#subscriptions.forEach(async (subscription): Promise<void> => {
this.#subscriptions.map(async (subscription): Promise<void> => {
try {
const unsubscribe = await subscription;

Expand Down
1 change: 0 additions & 1 deletion packages/api/src/promise/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ describe('ApiPromise', (): void => {
const registry = new TypeRegistry();
const keyring = createTestKeyring({ type: 'ed25519' });
const aliceEd = keyring.addPair(
// eslint-disable-next-line @typescript-eslint/unbound-method
createPair({ toSS58: keyring.encodeAddress, type: 'ed25519' }, {
publicKey: hexToU8a('0x88dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0ee'),
secretKey: hexToU8a('0xabf8e5bdbe30c65656c0a3cbd181ff8a56294a69dfedd27982aace4a7690911588dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0ee')
Expand Down
1 change: 0 additions & 1 deletion packages/rpc-core/src/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export class RpcCore {
* @param {ProviderInterface} provider An API provider using any of the supported providers (HTTP, SC or WebSocket)
*/
constructor (instanceId: string, registry: Registry, { isPedantic = true, provider, userRpc = {} }: Options) {
// eslint-disable-next-line @typescript-eslint/unbound-method
if (!provider || !isFunction(provider.send)) {
throw new Error('Expected Provider to API create');
}
Expand Down
6 changes: 2 additions & 4 deletions packages/rpc-core/src/replay.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ describe('replay', (): void => {

it('returns the observable value', async (): Promise<void> => {
await new Promise<boolean>((resolve) => {
rpc.system.chain().subscribe((value: any): void => {
rpc.system.chain().subscribe((value?: { toString: () => string }): void => {
if (value) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access, jest/no-conditional-expect
// eslint-disable-next-line jest/no-conditional-expect
expect(value.toString()).toEqual('mockChain'); // Defined in MockProvider
resolve(true);
}
Expand Down Expand Up @@ -56,7 +56,6 @@ describe('replay', (): void => {
});

it('unsubscribes as required', async (): Promise<void> => {
// eslint-disable-next-line @typescript-eslint/unbound-method
rpc.provider.unsubscribe = jest.fn();

await new Promise<boolean>((resolve) => {
Expand All @@ -65,7 +64,6 @@ describe('replay', (): void => {

// There's a promise inside .unsubscribe(), wait a bit (> 2s)
setTimeout((): void => {
// eslint-disable-next-line @typescript-eslint/unbound-method
expect(rpc.provider.unsubscribe).toHaveBeenCalled();
resolve(true);
}, 3500);
Expand Down
8 changes: 6 additions & 2 deletions packages/rpc-provider/src/substrate-connect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,15 @@ export class ScProvider implements ProviderInterface {

Promise
.race([
this.send(unsubscribeMethod, [id]).catch(() => undefined),
this.send(unsubscribeMethod, [id]).catch(() => {
// swallow
}),
new Promise((resolve) => setTimeout(resolve, 500))
])
.then(killStaleSubscriptions)
.catch(() => undefined);
.catch(() => {
// swallow
});
};

hc.start((health) => {
Expand Down

0 comments on commit 257ffe2

Please sign in to comment.