Move to @pezkuwi/dev 0.86.4 (eslint 10 toolchain)

- dev ^0.86.4 at the root and in packages/apps; directives renamed by
  pezkuwi-dev-migrate-eslint10.
- eslint --fix with the 0.86.4 config; one fix broke syntax
  (typescript-eslint prefer-optional-chain turned
  `(isStarted && onStart) && onStart()` into `(isStarted && onStart?.();`
  in TxButton) and is corrected by hand.
- The remaining findings fixed rather than disabled: optional chains
  (each suggestion reviewed), `cause` on rethrown errors, `if` instead of
  `a && promise` in effects, parallel instead of sequential awaits in
  Promise.all, Error rejections, no `delete` on arrays (the storage query
  cache is a Map; an upload's file list no longer keeps a hole), no
  `[object Object]` stringification (TFunction's second argument is text
  or options), dead code removed (referenda's never-shown expand button,
  react-query's unused CoreDescriptor).
This commit is contained in:
Satoshi Qazi Muhammed authored and SatoshiQaziMuhammed committed 2026-10-10 02:06:12 +04:00
1 parent c800e9affb
commit 45d479d2ec
323 files changed
+2925 -3514

No files matched your search

+1 -1
View File
@@ -48,7 +48,7 @@
"test:skipped": "echo 'tests skipped'"
},
"devDependencies": {
"@pezkuwi/dev": "^0.85.12",
"@pezkuwi/dev": "^0.86.4",
"@pezkuwi/extension-dapp": "^0.62.27",
"@pezkuwi/extension-inject": "^0.62.27",
"@types/chart.js": "^2.9.41",
@@ -6,5 +6,4 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
import { typesBundleForPolkadot as typesBundleForPezkuwi } from '@acala-network/type-definitions';
// External package types, cast to proper type for compatibility
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
export default ((typesBundleForPezkuwi as Record<string, unknown>).spec || {}) as Record<string, OverrideBundleDefinition>;
@@ -3,7 +3,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
{
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -3,7 +3,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
{
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -5,5 +5,4 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
import { typesBundleForPolkadot as typesBundleForPezkuwi } from '@crustio/type-definitions';
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
export default (typesBundleForPezkuwi as Record<string, Record<string, unknown>>).spec.crust as OverrideBundleDefinition;
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -3,7 +3,6 @@
// structs need to be in order
/* eslint-disable sort-keys */
/* eslint-disable camelcase */
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -1,8 +1,6 @@
// Copyright 2017-2026 @pezkuwi/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
import acala from './acala.js';
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -1,8 +1,6 @@
// Copyright 2017-2026 @pezkuwi/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@pezkuwi/api/types';
import type { DeriveBalancesAll } from '@pezkuwi/api-derive/types';
@@ -21,7 +19,6 @@ function balanceOf (number: number | string): U128 {
}
function defaultAccountBalance (): DeriveBalancesAll {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return {
accountNonce: new BN(1),
additional: [],
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -5,5 +5,4 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
import { typesBundleForPolkadot as typesBundleForPezkuwi } from '@laminar/type-definitions';
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
export default (typesBundleForPezkuwi as Record<string, Record<string, unknown>>).spec.laminar as OverrideBundleDefinition;
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
// structs need to be in order
/* eslint-disable sort-keys, @typescript-eslint/no-unsafe-assignment */
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@pezkuwi/api/types';
@@ -22,7 +21,6 @@ function balanceOf (number: number | string): U128 {
}
function defaultAccountBalance (): DeriveBalancesAll {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return {
accountNonce: new BN(1),
additional: [],
@@ -54,7 +52,6 @@ export function getBalance (
return {
...defaultAccountBalance(),
accountId: api.registry.createType('AccountId', account),
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
accountNonce: systemAccount.nonce,
availableBalance: api.registry.createType('Balance', data.free.sub(data.frozen)),
freeBalance: data.free,
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -3,7 +3,6 @@
// structs need to be in order
/* eslint-disable sort-keys */
/* eslint-disable camelcase */
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
-1
View File
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -6,5 +6,4 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
import { typesBundleForPolkadot as typesBundleForPezkuwi } from '@parallel-finance/type-definitions';
// External package types, cast to proper type for compatibility
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
export default ((typesBundleForPezkuwi as Record<string, unknown>).spec || {}) as Record<string, OverrideBundleDefinition>;
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
// structs need to be in order
/* eslint-disable sort-keys */
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@pezkuwi/api/types';
@@ -52,7 +51,6 @@ function createHeaderExtended (
api: ApiInterfaceRx
): HeaderExtended {
// HeaderBase is dynamically created at runtime, so we need type assertions
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const HeaderBase = registry.createClass('Header') as any;
class SubHeaderExtended extends HeaderBase {
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -4,7 +4,6 @@
import type { OverrideBundleDefinition } from '@pezkuwi/types/types';
// structs need to be in order
/* eslint-disable sort-keys */
const definitions: OverrideBundleDefinition = {
types: [
@@ -27,8 +27,8 @@ describe('typesBundle', (): void => {
import type { OverrideBundleType } from '@pezkuwi/types/types';
/* eslint-disable quotes */
/* eslint-disable quote-props */
/* eslint-disable @stylistic/quotes */
/* eslint-disable @stylistic/quote-props */
/* eslint-disable sort-keys */
export const typesBundle = ${JSON.stringify(typesBundle, null, 2)} as unknown as OverrideBundleType;
+2 -2
View File
@@ -5,8 +5,8 @@
import type { OverrideBundleType } from '@pezkuwi/types/types';
/* eslint-disable quotes */
/* eslint-disable quote-props */
/* eslint-disable @stylistic/quotes */
/* eslint-disable @stylistic/quote-props */
/* eslint-disable sort-keys */
export const typesBundle = {
@@ -77,7 +77,7 @@ describe('check endpoints', (): void => {
assert(result?.startsWith('0x'), 'Invalid/non-hex response');
resolve(result);
} catch (e) {
reject(e);
reject(e instanceof Error ? e : new Error(String(e)));
}
};
@@ -7,7 +7,6 @@ import type { LinkOption } from './types.js';
export const CUSTOM_ENDPOINT_KEY = 'pezkuwi-app-custom-endpoints';
interface EnvWindow {
// eslint-disable-next-line camelcase
process_env?: {
WS_URL: string;
}
+8 -3
View File
@@ -13,10 +13,15 @@ export { CUSTOM_ENDPOINT_KEY } from './development.js';
export * from './production.js';
export * from './testing.js';
function defaultT (keyOrText: string, text?: string | TOptions, options?: TOptions): string {
function defaultT (keyOrText: string, textOrOptions?: string | TOptions, options?: TOptions): string {
// as TFunction: the second argument is either the default text or the options
const [text, opts] = typeof textOrOptions === 'string'
? [textOrOptions, options]
: [undefined, textOrOptions];
return (
(options?.replace?.host as string) ||
text?.toString() ||
(opts?.replace?.host as string) ||
text ||
keyOrText
);
}
-1
View File
@@ -9,7 +9,6 @@ import Component, { useCounter } from '@pezkuwi/app-democracy';
function needsApiCheck (api: ApiPromise): boolean {
try {
// we need to be able to create an actual vote
// eslint-disable-next-line @typescript-eslint/no-explicit-any
api.tx.democracy.vote(1, { Standard: { balance: 1, vote: { aye: true, conviction: 1 } } } as any);
return true;
-2
View File
@@ -19,13 +19,11 @@ function needsApiCheck (api: ApiPromise): boolean {
}
// we need a known Exposure type
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const { nominatorCount, own, pageCount, total } = api.registry.createType<PezspStakingPagedExposureMetadata>(
unwrapStorageType(api.registry, api.query.staking.erasStakersOverview.creator.meta.type),
{ nominatorCount: BN_ONE, own: BN_ONE, pageCount: BN_ONE, total: BN_ONE }
);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
assert(total && own && nominatorCount && pageCount && total.eq(BN_ONE) && own.eq(BN_ONE), 'Needs a known Exposure type');
} catch {
console.warn('Unable to create known-shape Exposure type, disabling staking route');
-2
View File
@@ -13,13 +13,11 @@ import { assert, BN_ONE } from '@pezkuwi/util';
function needsApiCheck (api: ApiPromise): boolean {
try {
// we need a known Exposure type
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const { others: [{ value, who }], own, total } = api.registry.createType<PezspStakingExposure>(
unwrapStorageType(api.registry, api.query.staking.erasStakers.creator.meta.type),
{ others: [{ value: BN_ONE, who: ZERO_ACCOUNT }], own: BN_ONE, total: BN_ONE }
);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
assert(total && own && value && who && total.eq(BN_ONE) && own.eq(BN_ONE) && value.eq(BN_ONE), 'Needs a known Exposure type');
} catch {
console.warn('Unable to create known-shape Exposure type, disabling staking route');
+1 -1
View File
@@ -19,7 +19,7 @@
"@acala-network/chopsticks-core": "^1.2.1",
"@pezkuwi/apps-config": "^1.0.2-1-x",
"@pezkuwi/apps-routing": "^1.0.2-1-x",
"@pezkuwi/dev": "^0.85.2",
"@pezkuwi/dev": "^0.86.4",
"@pezkuwi/react-api": "^1.0.2-1-x",
"@pezkuwi/react-components": "^1.0.2-1-x",
"@pezkuwi/react-hooks": "^1.0.2-1-x",
@@ -12,7 +12,7 @@ const BrowserCheckAlert: React.FC = () => {
const ua = navigator.userAgent;
// Detect Firefox
const firefoxMatch = ua.match(/Firefox\/(\d+\.\d+)/);
const firefoxMatch = /Firefox\/(\d+\.\d+)/.exec(ua);
if (firefoxMatch) {
// Check for Firefox 145.0 specifically
+1 -1
View File
@@ -31,7 +31,7 @@ function GroupDisplay ({ affinities, apiUrl, children, className = '', favoriteC
[index, isSelected, setGroup]
);
const isFavoriteHeader = useMemo(() => header?.toString().includes('Favorite'), [header]);
const isFavoriteHeader = useMemo(() => typeof header === 'string' && header.includes('Favorite'), [header]);
const filtered = useMemo(
() => networks.filter(({ isUnreachable }) => !isUnreachable),
+3 -3
View File
@@ -63,9 +63,9 @@ function combineEndpoints (endpoints: LinkOption[]): Group[] {
const prov = { isLightClient: e.isLightClient, name: e.textBy, url: e.value };
const isFavorite = isFavoriteChain(favoriteChains,
{ chainName: e.text?.toString() ?? '',
{ chainName: typeof e.text === 'string' ? e.text : '',
paraId: e.paraId,
relay: e.textRelay?.toString() });
relay: typeof e.textRelay === 'string' ? e.textRelay : undefined });
if (isFavorite && favoriteGroupIndex !== -1 && !e.isUnreachable) {
const favGroup = result[favoriteGroupIndex];
@@ -106,7 +106,7 @@ function combineEndpoints (endpoints: LinkOption[]): Group[] {
// Swap first two items in `networks` if first item is relay chain
combinedEndpoints.forEach((r) => {
if (r.networks.length >= 2 && r.networks[0].isRelay && r.header?.toString().includes('teyrchains')) {
if (r.networks.length >= 2 && r.networks[0].isRelay && typeof r.header === 'string' && r.header.includes('teyrchains')) {
[r.networks[0], r.networks[1]] = [r.networks[1], r.networks[0]];
}
});
+1 -1
View File
@@ -9,7 +9,7 @@ export interface IFavoriteChainProps {
paraId?: number;
}
export type IFavoriteChainsStorage = Record<string, {relay: string, paraId: number}[]>
export type IFavoriteChainsStorage = Record<string, { relay: string, paraId: number }[]>;
export interface Network {
isChild?: boolean;
+1 -1
View File
@@ -6,7 +6,7 @@ import type { IFavoriteChainProps, IFavoriteChainsStorage } from './types.js';
import { createWsEndpoints } from '@pezkuwi/apps-config';
export const FAVORITE_CHAINS_KEY = 'pezkuwi-app-favorite-chains';
const chainsConfig = createWsEndpoints((k, v) => v?.toString() || k);
const chainsConfig = createWsEndpoints((k, v) => (typeof v === 'string' && v) || k);
export const toggleFavoriteChain = (
chainInfo: IFavoriteChainProps
@@ -3,7 +3,7 @@
// This is for the use of `Ledger`
//
/* eslint-disable deprecation/deprecation */
/* eslint-disable @typescript-eslint/no-deprecated */
import type { ApiPromise } from '@pezkuwi/api';
import type { SubmittableExtrinsic } from '@pezkuwi/api/types';
@@ -41,7 +41,8 @@ function useMultisigApprovalsImpl (address: string): [H256, Multisig][] | undefi
// query all the entries for the multisig, extracting approvals with their hash
useEffect((): void => {
trigger && api.query.multisig?.multisigs && api.query.multisig?.multisigs
if (trigger) {
api.query.multisig?.multisigs
.entries(address)
.then((infos: [StorageKey, Option<Multisig>][]): void => {
mountedRef.current && setMultiInfos(
@@ -51,6 +52,7 @@ function useMultisigApprovalsImpl (address: string): [H256, Multisig][] | undefi
);
})
.catch(console.error);
}
}, [address, api, mountedRef, trigger]);
return multiInfos;
@@ -45,7 +45,7 @@ function useProxiesImpl (address?: string | null): State | null {
useEffect((): void => {
setState(null);
address &&
if (address) {
api.query.proxy
?.proxies<ITuple<[Vec<ITuple<[AccountId, KitchensinkRuntimeProxyType]> | PezpalletProxyProxyDefinition>, BalanceOf]>>(address)
.then(([_proxies]): void => {
@@ -65,6 +65,7 @@ function useProxiesImpl (address?: string | null): State | null {
});
})
.catch(console.error);
}
}, [allAccounts, api, address, mountedRef]);
return known;
+1 -1
View File
@@ -39,7 +39,7 @@ function Backup ({ address, onClose }: Props): React.ReactElement<Props> {
const json = addressKeyring && keyring.backupAccount(addressKeyring, password);
const blob = new Blob([JSON.stringify(json)], { type: 'application/json; charset=utf-8' });
// eslint-disable-next-line deprecation/deprecation
// eslint-disable-next-line @typescript-eslint/no-deprecated
FileSaver.saveAs(blob, `${address}.json`);
} catch (error) {
setBackupFailed(true);
+1 -1
View File
@@ -106,7 +106,7 @@ function generateSeed (_seed: string | undefined | null, derivePath: string, see
function updateAddress (seed: string, derivePath: string, seedType: SeedType, pairType: PairType): AddressState {
let address: string | null = null;
let deriveValidation: DeriveValidationOutput = deriveValidate(seed, seedType, derivePath, pairType);
let isSeedValid = false;
let isSeedValid: boolean;
if (seedType === 'raw') {
isSeedValid = rawValidate(seed);
@@ -68,7 +68,7 @@ function ExportAll ({ accountsByGroup, className, onClose, onStatusChange }: Pro
const blob = new Blob([JSON.stringify(accounts, null, 2)], { type: 'application/json; charset=utf-8' });
// eslint-disable-next-line deprecation/deprecation
// eslint-disable-next-line @typescript-eslint/no-deprecated
FileSaver.saveAs(blob, `batch_exported_accounts_${new Date().getTime()}.json`);
status.status = 'success';
@@ -138,7 +138,7 @@ function ExportAll ({ accountsByGroup, className, onClose, onStatusChange }: Pro
);
}
const BrowserAccounts = ({ accounts, allPassword, setAllPassword }: {accounts: string[], allPassword: TPassword[], setAllPassword: React.Dispatch<React.SetStateAction<TPassword[]>>}) => {
const BrowserAccounts = ({ accounts, allPassword, setAllPassword }: { accounts: string[], allPassword: TPassword[], setAllPassword: React.Dispatch<React.SetStateAction<TPassword[]>> }) => {
const { t } = useTranslation();
const _onChangePass = useCallback(
@@ -7,7 +7,7 @@ import { MarkWarning } from '@pezkuwi/react-components';
import { useTranslation } from '../translate.js';
const isElectron = navigator.userAgent.toLowerCase().indexOf(' electron/') > -1;
const isElectron = navigator.userAgent.toLowerCase().includes(' electron/');
function ExternalWarning (): React.ReactElement | null {
const { t } = useTranslation();
@@ -53,8 +53,8 @@ interface PeopleIdentityInfo extends Struct {
const WHITESPACE = [' ', '\t'];
function setData (data: Data, setActive: null | ((isActive: boolean) => void), setVal: (val: string) => void): void {
if (data && data.isRaw) {
setActive && setActive(true);
if (data?.isRaw) {
setActive?.(true);
setVal(u8aToString(data.asRaw.toU8a(true)));
}
}
@@ -64,7 +64,7 @@ function setAdditionalFieldData (api: ApiPromise, info: IdentityInfo, key: strin
const dataNone = api.registry.createType('Data', '');
const value = info.additional.find((v) => v[0].eq(dataKey))?.[1] || dataNone;
if (value && value.isRaw) {
if (value?.isRaw) {
setData(value, setActive, setVal);
}
@@ -73,7 +73,7 @@ function setAdditionalFieldData (api: ApiPromise, info: IdentityInfo, key: strin
function setDiscordFieldData (info: PeopleIdentityInfo, setActive: null | ((isActive: boolean) => void), setVal: (val: string) => void): Data {
if (info.discord && !info.discord.isNone) {
setActive && setActive(true);
setActive?.(true);
setVal(u8aToString(info.discord.asRaw.toU8a(true)));
}
@@ -124,7 +124,7 @@ function IdentityMain ({ address, className = '', onClose }: Props): React.React
const [isPalletChecked, setIsPalletChecked] = useState<boolean>(false);
useEffect((): void => {
if (identityOpt && identityOpt.isSome) {
if (identityOpt?.isSome) {
const identity = identityOpt.unwrap();
const foundInfo = Array.isArray(identity) ? identity[0].info : (identity as Registration).info;
@@ -150,7 +150,7 @@ function IdentityMain ({ address, className = '', onClose }: Props): React.React
: [foundInfo.display, foundInfo.email, (foundInfo as unknown as PeopleIdentityInfo).github, foundInfo.legal, (foundInfo as unknown as PeopleIdentityInfo).matrix, foundInfo.twitter, infoDiscord, foundInfo.web];
previousKeys.some((info: Data | null) => {
if (info && info.isRaw) {
if (info?.isRaw) {
setGotPreviousIdentity(true);
return true;
@@ -26,7 +26,7 @@ interface TPassword {
type FileAccount = (KeyringPair$Json | KeyringPair);
type File = FileAccount[]
type File = FileAccount[];
const acceptedFormats = ['application/json'];
+1 -1
View File
@@ -3,7 +3,7 @@
// This is for the use of `Ledger`
//
/* eslint-disable deprecation/deprecation */
/* eslint-disable @typescript-eslint/no-deprecated */
import type { ApiPromise } from '@pezkuwi/api';
import type { Ledger, LedgerGeneric } from '@pezkuwi/hw-ledger';
@@ -140,7 +140,6 @@ function MultisigApprove ({ className = '', onClose, ongoing, threshold = 0, who
? isMultiCall && isCallOverride
? callData
? multiMod.asMulti.meta.args.length === 5
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
? multiMod.asMulti(threshold, others as any, multisig.when, callData.toHex(), weight as any)
: multiMod.asMulti.meta.args.length === 6
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -151,7 +150,6 @@ function MultisigApprove ({ className = '', onClose, ongoing, threshold = 0, who
: multiMod.asMulti(threshold, others as any, multisig.when, callData)
: null
: multiMod.approveAsMulti.meta.args.length === 5
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
? multiMod.approveAsMulti(threshold, others as any, multisig.when, hash, weight as any)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
@@ -245,7 +245,7 @@ function ProxyOverview ({ className, onClose, previousProxy: [existing] = EMPTY_
[api]
);
const isSameAdd = added.some(([accountId]) => accountId && accountId.eq(proxiedAccount));
const isSameAdd = added.some(([accountId]) => accountId?.eq(proxiedAccount));
return (
<StyledModal
+1 -1
View File
@@ -33,7 +33,7 @@ export function createMenuGroup (key: string, items: (React.ReactNode | false |
export type AccountIdIsh = AccountId | AccountIndex | Address | string | Uint8Array | null;
export function downloadAccount ({ json, pair }: CreateResult): void {
// eslint-disable-next-line deprecation/deprecation
// eslint-disable-next-line @typescript-eslint/no-deprecated
FileSaver.saveAs(
new Blob([JSON.stringify(json)], { type: 'application/json; charset=utf-8' }),
`${pair.address}.json`
@@ -29,7 +29,7 @@ function Export ({ sortedAddresses }: Props): React.ReactElement<Props> {
const blob = new Blob([JSON.stringify(accounts, null, 2)], { type: 'application/json; charset=utf-8' });
// eslint-disable-next-line deprecation/deprecation
// eslint-disable-next-line @typescript-eslint/no-deprecated
FileSaver.saveAs(blob, `batch_exported_address_book_${new Date().getTime()}.json`);
/** ********************* ************** ************************/
@@ -7,4 +7,4 @@ export interface SortedAddress { address: string; isFavorite: boolean, isVisible
export interface SaveFile { address: string; isFavorite: boolean, name: string }
export type FunInputFile = (e: React.ChangeEvent<HTMLInputElement>) => void
export type FunInputFile = (e: React.ChangeEvent<HTMLInputElement>) => void;
+1 -1
View File
@@ -18,7 +18,7 @@ function useMemberInfoImpl (accountId: string): MemberInfo | undefined {
() => depositOf && {
accountId,
deposit: depositOf.unwrapOr(null),
isUpForKicking: upForKicking && upForKicking.isTrue,
isUpForKicking: upForKicking?.isTrue,
retiringAt: retiringAt?.unwrapOr(null)
},
[accountId, depositOf, retiringAt, upForKicking]
+1 -1
View File
@@ -62,7 +62,7 @@ const BASE_BORDER = 0.125;
const BORDER_TOP = `${BASE_BORDER * 3}rem solid var(--bg-page)`;
const BORDER_RADIUS = `${BASE_BORDER * 4}rem`;
const StyledTr = styled.tr<{isFirstItem: boolean; isLastItem: boolean}>`
const StyledTr = styled.tr<{ isFirstItem: boolean; isLastItem: boolean }>`
td {
border-top: ${(props) => props.isFirstItem && BORDER_TOP};
border-radius: 0rem !important;
+1 -2
View File
@@ -34,8 +34,7 @@ function Balances ({ className, infos = [] }: Props): React.ReactElement<Props>
const completeAssets = useMemo(
() => infos
.filter((i): i is AssetInfoComplete => !!(i.details && i.metadata) && !i.details.supply.isZero())
,
.filter((i): i is AssetInfoComplete => !!(i.details && i.metadata) && !i.details.supply.isZero()),
[infos]
);
@@ -26,7 +26,7 @@ function Mint ({ className, details: { issuer, minBalance }, id, metadata, onClo
const [recipientId, setRecipientId] = useState<string | null>(null);
const isAmountValid = useMemo(
() => amount && amount.gte(minBalance),
() => amount?.gte(minBalance),
[amount, minBalance]
);
+1 -1
View File
@@ -23,7 +23,7 @@ function Query ({ className = '', onQuery }: Props): React.ReactElement<Props> {
const _onQuery = useCallback(
(): void => {
onQuery && onQuery(input);
onQuery?.(input);
},
[input, onQuery]
);
+1 -1
View File
@@ -77,7 +77,7 @@ function AssetApp ({ basePath, className }: Props): React.ReactElement<Props> {
]);
const showForeignAssetsTab = useMemo(() => !!foreignAssetLocations.length, [foreignAssetLocations.length]);
const showBalancesTab = useMemo(() => hasAccounts && infos && infos.some(({ details, metadata }) => !!(details && metadata)), [hasAccounts, infos]);
const showBalancesTab = useMemo(() => hasAccounts && infos?.some(({ details, metadata }) => !!(details && metadata)), [hasAccounts, infos]);
const hidden = useMemo(
() =>
@@ -68,7 +68,7 @@ function useForeignAssetInfosImpl (locations?: StagingXcmV3MultiLocation[]): For
const [state, setState] = useState<ForeignAssetInfo[] | undefined>();
useEffect((): void => {
details && metadata && (details[0][0].length === metadata[0][0].length) &&
details && details[0][0].length === metadata?.[0][0].length &&
setState(
details[0][0].map((location, index) =>
extractInfo(allAccounts, location, details[1][index], metadata[1][index])
+2 -2
View File
@@ -52,9 +52,9 @@ jest.mock('./hooks/useBounties', () => ({
let aProposal: (extrinsic: SubmittableExtrinsic<'promise'>, ayes?: string[], nays?: string[]) => DeriveCollectiveProposal;
let augmentedApi: any;
let aBounty: ({ status, value }?: Partial<PezpalletBountiesBounty>) => PezpalletBountiesBounty;
let aBounty: (bounty?: Partial<PezpalletBountiesBounty>) => PezpalletBountiesBounty;
let aBountyIndex: (index?: number) => BountyIndex;
let bountyStatusWith: ({ curator, status, updateDue }: { curator?: string, status?: string, updateDue?: number}) => PezpalletBountiesBountyStatus;
let bountyStatusWith: ({ curator, status, updateDue }: { curator?: string, status?: string, updateDue?: number }) => PezpalletBountiesBountyStatus;
let bountyWith: ({ status, value }: { status?: string, value?: number }) => PezpalletBountiesBounty;
describe('Bounties', () => {
@@ -53,14 +53,14 @@ function Index ({ bestNumber, className, description, index, proposals, status }
const existingCloseBountyProposal = useMemo(
() => proposals?.find(({ proposal }) =>
proposal && proposal.method === 'closeBounty'
proposal?.method === 'closeBounty'
),
[proposals]
);
const existingUnassignCuratorProposal = useMemo(
() => proposals?.find(({ proposal }) =>
proposal && proposal.method === 'unassignCurator'
proposal?.method === 'unassignCurator'
),
[proposals]
);
@@ -19,7 +19,7 @@ export function determineUnassignCuratorAction (roles: UserRole[], status: Pezpa
actions.push('SlashCuratorMotion');
}
if (roles.includes('User') && blocksUntilUpdate && blocksUntilUpdate.lt(BN_ZERO)) {
if (roles.includes('User') && blocksUntilUpdate?.lt(BN_ZERO)) {
actions.push('SlashCuratorAction');
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ export interface BountyStatusType {
export type HelpMessages = Record<StatusName, string>;
export type StatusName = 'Active' | 'Approved' | 'CuratorProposed' | 'Funded' | 'PendingPayout' | 'Proposed';
export type BountyVotingStatuses = { [status in StatusName]: string[] };
export type BountyVotingStatuses = Record<StatusName, string[]>;
export type ValidUnassignCuratorAction = 'UnassignCurator' | 'SlashCuratorMotion' | 'SlashCuratorAction';
export type UnassignCuratorAction = ValidUnassignCuratorAction | 'None';
export type UserRole = 'User' | 'Member' | 'Curator' | 'None';
@@ -37,7 +37,7 @@ function aGenesisHash () {
}
type FindOne = (match: string) => Promise<HTMLElement>;
type FindManyWithMatcher = (match: string | ((match: string) => boolean)) => Promise<HTMLElement[]>
type FindManyWithMatcher = (match: string | ((match: string) => boolean)) => Promise<HTMLElement[]>;
type GetMany = (match: string) => HTMLElement[];
class NotYetRendered extends Error {
@@ -57,7 +57,7 @@ interface RenderedBountiesPage {
}
export class BountiesPage {
aBounty: ({ status, value }?: Partial<PezpalletBountiesBounty>) => PezpalletBountiesBounty;
aBounty: (bounty?: Partial<PezpalletBountiesBounty>) => PezpalletBountiesBounty;
aBountyIndex: (index?: number) => BountyIndex;
aBountyStatus: (status: string) => PezpalletBountiesBountyStatus;
bountyStatusWith: ({ curator, status }: { curator?: string, status?: string, }) => PezpalletBountiesBountyStatus;
@@ -40,8 +40,8 @@ function Filters ({ data, onFilter }: Props): React.ReactElement<Props> {
const coreArr: number[] = useMemo(() =>
data?.length
? Array.from({ length: data.length || 0 }, (_, index) => index)
: []
, [data]);
: [],
[data]);
const { t } = useTranslation();
const teyrchainId = useDebounce(_teyrchainId);
@@ -19,7 +19,7 @@ function RegionLength ({ children, className }: Props): React.ReactElement<Props
return (
<div className={className}>
{length?.toString() || '-'}
{typeof length === 'number' ? length : '-'}
{children}
</div>
);
@@ -34,8 +34,8 @@ function Workload ({ api, config, core, workload, workplan }: Props): React.Reac
const { currentRegion, status } = useBrokerContext();
const currentTimeSlice = useMemo(() =>
status?.lastTimeslice ?? 0
, [status]);
status?.lastTimeslice ?? 0,
[status]);
const regionInfo = useRegions(api);
const regionOwnerInfo: RegionInfo | undefined = useMemo(() => regionInfo?.find((v) => v.core === core && v.start <= currentTimeSlice && v.end > currentTimeSlice), [regionInfo, core, currentTimeSlice]);
+2 -2
View File
@@ -18,8 +18,8 @@ interface Props {
className?: string;
}
type LeaseMapType = Record<number, LegacyLease>
type ReservationMapType = Record<number, Reservation>
type LeaseMapType = Record<number, LegacyLease>;
type ReservationMapType = Record<number, Reservation>;
const formatDataObject = (one: CoreWorkplan | CoreWorkload, leaseMap: LeaseMapType, reservationMap: ReservationMapType) => ({
...one,
+1 -1
View File
@@ -100,7 +100,7 @@ function DayItem ({ className, item: { blockNumber, date, info, type }, showAllE
: ['teyrchainAuction'].includes(type)
? createLink('teyrchains/auction', t('via Teyrchains/Auction'))
: undefined;
let s = '';
let s: string;
switch (type) {
case 'councilElection':
+1 -1
View File
@@ -3,7 +3,7 @@
import type { BN } from '@pezkuwi/util';
export type EntryType = 'councilElection' | 'councilMotion' | 'democracyDispatch' | 'democracyLaunch' | 'teyrchainAuction' | 'teyrchainLease' | 'referendumDispatch' | 'referendumVote' | 'scheduler' | 'societyChallenge' | 'societyRotate'| 'stakingEpoch' | 'stakingEra' | 'stakingSlash' | 'treasurySpend';
export type EntryType = 'councilElection' | 'councilMotion' | 'democracyDispatch' | 'democracyLaunch' | 'teyrchainAuction' | 'teyrchainLease' | 'referendumDispatch' | 'referendumVote' | 'scheduler' | 'societyChallenge' | 'societyRotate' | 'stakingEpoch' | 'stakingEra' | 'stakingSlash' | 'treasurySpend';
export interface EntryInfo {
blockNumber: BN;
+1 -1
View File
@@ -8,7 +8,7 @@ import { AddressMini, Card, styled } from '@pezkuwi/react-components';
import { useTranslation } from './translate.js';
import usePezkuwiPreclaims from './usePezkuwiPreclaims.js';
export interface Props{
export interface Props {
className?: string;
}
+2 -2
View File
@@ -28,7 +28,7 @@ enum Step {
Account = 0,
ETHAddress = 1,
Sign = 2,
Claim = 3,
Claim = 3
}
const PRECLAIMS_LOADING = 'PRECLAIMS_LOADING';
@@ -105,7 +105,7 @@ function ClaimsApp ({ basePath }: Props): React.ReactElement<Props> {
setEthereumAddress(null);
setPreclaimEthereumAddress(PRECLAIMS_LOADING);
if (!api.query.claims || !api.query.claims.preclaims) {
if (!api.query.claims?.preclaims) {
return setPreclaimEthereumAddress(null);
}
+1 -1
View File
@@ -18,7 +18,7 @@ declare module 'react-copy-to-clipboard' {
options?: Options;
}
function CopyToClipboard(props: Props): ReactElement;
function CopyToClipboard (props: Props): ReactElement;
export = CopyToClipboard;
}
+1 -1
View File
@@ -35,7 +35,7 @@ function Code ({ className, code, onShowDeploy }: Props): React.ReactElement<Pro
const _onDeployConstructor = useCallback(
(constructorIndex?: number): void => {
onShowDeploy && onShowDeploy(code.json.codeHash, constructorIndex || 0);
onShowDeploy?.(code.json.codeHash, constructorIndex || 0);
},
[code, onShowDeploy]
);
@@ -97,7 +97,6 @@ function Upload ({ onClose }: Props): React.ReactElement {
: api.registry.createType('Balance', BN_ZERO),
weight.weightV2,
null,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
{ Upload: api.registry.createType('Raw', wasm) } as any,
contractAbi?.constructors[constructorIndex]?.toU8a(params),
''
@@ -1,8 +1,6 @@
// Copyright 2017-2026 @pezkuwi/app-contracts authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable camelcase */
import type { Option } from '@pezkuwi/types';
import type { PrefabWasmModule } from '@pezkuwi/types/interfaces';
@@ -138,11 +138,11 @@ function Call ({ className = '', contract, messageIndex, onCallResult, onChangeM
params,
when: new Date()
}, ...outcomes]);
onCallResult && onCallResult(messageIndex, result);
onCallResult?.(messageIndex, result);
})
.catch((error): void => {
console.error(error);
onCallResult && onCallResult(messageIndex);
onCallResult?.(messageIndex);
});
},
[accountId, contract.query, message, messageIndex, onCallResult, outcomes, params, value, weight]
@@ -108,7 +108,7 @@ function Deploy ({ codeHash, constructorIndex = 0, onClose, setConstructorIndex
tags: []
});
onClose && onClose();
onClose?.();
}
},
[api, name, onClose]
+1 -1
View File
@@ -21,7 +21,7 @@ function RemoveABI ({ code, onClose, onRemove }: Props): React.ReactElement<Prop
const _onRemove = useCallback(
(): void => {
onClose && onClose();
onClose?.();
onRemove();
},
[onClose, onRemove]
@@ -42,7 +42,7 @@ function Message ({ className = '', index, lastResult, message, onSelect }: Prop
const { t } = useTranslation();
const _onSelect = useCallback(
() => onSelect && onSelect(index),
() => onSelect?.(index),
[index, onSelect]
);
Loaded 100 of 323 files, more files were not shown because too many files have changed in this diff. Show more