mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-10-20 18:56:18 +00:00
Move to @pezkuwi/dev 0.86 (eslint 10 toolchain)
- @pezkuwi/dev, dev-test, dev-ts ^0.86.3 - rethrown errors carry the original as `cause` (hw-ledger, address decode) - optional chain in isEthereumAddress, includes() in bip39 validation - logger calls the lazy formatter through a typed function - x-global: an assertion to the type the value already has removed, with the comment and directive that explained it - type-only re-exports of modules that emit no JavaScript - disable directives renamed for the new rule names, or removed where the rule no longer reports
This commit is contained in:
1 parent
82d6a12c24
commit
c46ce1a9e6
23 files changed
+2630
-3264
No files matched your search
@@ -16,7 +16,7 @@ class ExtString extends String {
|
||||
|
||||
// NOTE Hex value outputs created via online conversion tool:
|
||||
// https://www.h-schmidt.net/FloatConverter/IEEE754.html
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
|
||||
const TESTS: [isLe: boolean | undefined, bitLength: 32 | 64 | undefined, input: String | string | number | Number, output: string][] = [
|
||||
[undefined, undefined, +0.0, '0x00000000'],
|
||||
[undefined, undefined, -0.0, '0x00000080'],
|
||||
|
||||
@@ -11,7 +11,7 @@ interface Options {
|
||||
* @description Converts a float into a U8a representation (While we don't use BE in SCALE
|
||||
* we still allow for either representation, although, as elsewhere, isLe is default)
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
|
||||
export function floatToU8a (value: String | string | number | Number = 0.0, { bitLength = 32, isLe = true }: Options = {}): Uint8Array {
|
||||
if (bitLength !== 32 && bitLength !== 64) {
|
||||
throw new Error('Invalid bitLength provided, expected 32 or 64');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2026 @pezkuwi/util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
type FnType = Function;
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* console.log('isInstanceOf', isInstanceOf(new Array(0), Array)); // => true
|
||||
* ```
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
export function isInstanceOf (value: unknown, Clazz: Function): boolean {
|
||||
return (
|
||||
((value && (value as Record<string, unknown>).constructor) === Clazz) ||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
* console.log('isUndefined', isUndefined(void(0))); // => true
|
||||
* ```
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export function isUndefined (value?: unknown): value is undefined {
|
||||
return value === undefined;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ function formatWithLength (maxLength: number): (v: unknown) => unknown {
|
||||
|
||||
function apply (log: LogType, type: string, values: unknown[], maxSize = -1): void {
|
||||
if (values.length === 1 && isFunction(values[0])) {
|
||||
const fnResult = values[0]() as unknown;
|
||||
const fnResult = (values[0] as () => unknown)();
|
||||
|
||||
return apply(log, type, Array.isArray(fnResult) ? fnResult : [fnResult], maxSize);
|
||||
}
|
||||
|
||||
@@ -62,9 +62,9 @@ export interface Time {
|
||||
|
||||
export type Memoized<F> = F & {
|
||||
unmemoize: (...args: unknown[]) => void;
|
||||
}
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
|
||||
export type AnyString = string | String;
|
||||
|
||||
export type HexDigit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
|
||||
|
||||
Reference in new issue
Block a user