mirror of
https://github.com/pezkuwichain/pezkuwi-api.git
synced 2026-11-10 09:07:06 +00:00
Move to @pezkuwi/dev 0.86 (eslint 10 toolchain)
- @pezkuwi/dev, dev-test, dev-ts ^0.86.3; disable directives renamed for the new rule names, or removed where the rule no longer reports - rethrown errors carry the original as `cause` (13 sites) - optional chains where a guard expression tested the same value - Init: the registry cache settles with the creator's own promise, dropping the entry in finally(), instead of re-wrapping it - Combinator: a typed call instead of `Function` - checkTypes.manual: synchronous checks run outside Promise.all - sortValues, createTypeUnsafe: initial values that were never read - typegen util: load docs.js for its side effect (it registers the `docs` Handlebars partial) now that its types are re-exported type-only - MockProvider keeps its Header assertion: the package's own build does not load api-augment, so createType returns a plain Codec there - Decorate keeps `delete queue[i]`: the hole marks a fired queue and later indexes must not shift
This commit is contained in:
1 parent
8c9af013b5
commit
60e0f73ffa
166 files changed
+2757
-3731
No files matched your search
@@ -127,7 +127,7 @@ class InnerChecker {
|
||||
};
|
||||
|
||||
responsePassThrough = (jsonRpcResponse: string): string | null => {
|
||||
let parsedResponse: {id: string, result?: SmoldotHealth, params?: { subscription: string }};
|
||||
let parsedResponse: { id: string, result?: SmoldotHealth, params?: { subscription: string } };
|
||||
|
||||
try {
|
||||
parsedResponse = JSON.parse(jsonRpcResponse) as { id: string, result?: SmoldotHealth };
|
||||
|
||||
@@ -69,8 +69,8 @@ describe('RpcError', (): void => {
|
||||
});
|
||||
|
||||
describe('stack traces', (): void => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
let captureStackTrace: (targetObject: Record<string, any>, constructorOpt?: Function | undefined) => void;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
let captureStackTrace: (targetObject: Record<string, any>, constructorOpt?: Function) => void;
|
||||
|
||||
beforeEach((): void => {
|
||||
captureStackTrace = Error.captureStackTrace;
|
||||
|
||||
@@ -36,7 +36,7 @@ export class RpcCoder {
|
||||
#id = 0;
|
||||
|
||||
public decodeResponse <T> (response?: JsonRpcResponse<T>): T {
|
||||
if (!response || response.jsonrpc !== '2.0') {
|
||||
if (response?.jsonrpc !== '2.0') {
|
||||
throw new Error('Invalid jsonrpc field in decoded object');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// Copyright 2017-2026 @pezkuwi/rpc-provider authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
import type { Header } from '@pezkuwi/types/interfaces';
|
||||
import type { Codec, Registry } from '@pezkuwi/types/types';
|
||||
import type { ProviderInterface, ProviderInterfaceEmitCb, ProviderInterfaceEmitted } from '../types.js';
|
||||
@@ -53,12 +51,9 @@ export class MockProvider implements ProviderInterface {
|
||||
private prevNumber = new BN(-1);
|
||||
|
||||
private requests: Record<string, (...params: any[]) => unknown> = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
chain_getBlock: () => this.registry.createType('SignedBlock', rpcSignedBlock.result).toJSON(),
|
||||
chain_getBlockHash: () => '0x1234000000000000000000000000000000000000000000000000000000000000',
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
chain_getFinalizedHead: () => this.registry.createType('Header', rpcHeader.result).hash,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
chain_getHeader: () => this.registry.createType('Header', rpcHeader.result).toJSON(),
|
||||
rpc_methods: () => this.registry.createType('RpcMethods').toJSON(),
|
||||
state_getKeys: () => [],
|
||||
@@ -236,6 +231,9 @@ export class MockProvider implements ProviderInterface {
|
||||
|
||||
this.prevNumber = blockNumber;
|
||||
|
||||
// Needed in this package's own build, where api-augment is not loaded and
|
||||
// createType returns a plain Codec; the repository-wide lint sees it augmented.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
return header as unknown as Header;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { Server } from 'mock-socket';
|
||||
export type Global = typeof globalThis & {
|
||||
WebSocket: typeof WebSocket;
|
||||
fetch: any;
|
||||
}
|
||||
};
|
||||
|
||||
export interface Mock {
|
||||
body: Record<string, Record<string, unknown>>;
|
||||
|
||||
@@ -79,7 +79,6 @@ describe('send', (): void => {
|
||||
.send('test_body', ['param'])
|
||||
.then((): void => {
|
||||
expect(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
(mock.body as any).test_body
|
||||
).toEqual('{"id":1,"jsonrpc":"2.0","method":"test_body","params":["param"]}');
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user