mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-10-20 18:56:30 +00:00
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:
1 parent
c800e9affb
commit
45d479d2ec
325 files changed
+2942
-3531
No files matched your search
@@ -57,7 +57,7 @@ function Contribute ({ cap, className, needsSignature, paraId, raised }: Props):
|
||||
|
||||
const remaining = cap.sub(raised);
|
||||
const isAmountBelow = !amount || amount.lt(api.consts.crowdloan.minContribution as BalanceOf);
|
||||
const isAmountOver = !!(amount && amount.gt(remaining));
|
||||
const isAmountOver = !!(amount?.gt(remaining));
|
||||
const isAmountError = isAmountBelow || isAmountOver;
|
||||
const minContribution = api.consts.crowdloan.minContribution as BlockNumber;
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ function Fund ({ bestHash, bestNumber, className = '', isOngoing, leasePeriod, v
|
||||
);
|
||||
}
|
||||
|
||||
interface IDissolveCrowdloan{
|
||||
interface IDissolveCrowdloan {
|
||||
isEnded?: boolean;
|
||||
paraId: ParaId;
|
||||
isDepositor: boolean;
|
||||
|
||||
@@ -124,7 +124,7 @@ function Teyrchain ({ bestNumber, className = '', id, lastBacked, lastInclusion,
|
||||
<div className='shortHash'>{paraInfo.headHex}</div>
|
||||
</td>
|
||||
<td className='start'>
|
||||
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
|
||||
{}
|
||||
{paraInfo.updateAt && bestNumber && (paraInfo.lifecycle as any)?.isTeyrchain
|
||||
? (
|
||||
<>
|
||||
|
||||
@@ -36,7 +36,7 @@ function includeEntry (map: EventMap, event: Event, blockHash: string, blockNumb
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
throw new Error(`${event.section}.${event.method}(${stringify(event.data)}):: ${(error as Error).message}`);
|
||||
throw new Error(`${event.section}.${event.method}(${stringify(event.data)}):: ${(error as Error).message}`, { cause: error });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ function mapValidators (startWith: Record<string, [GroupIndex, ValidatorInfo[]]>
|
||||
return ids.reduce((all: Record<string, [GroupIndex, ValidatorInfo[]]>, id) => {
|
||||
// paraId should never be undefined, since it comes from the state, yet here we are...
|
||||
// See https://github.com/pezkuwichain/pezkuwi-apps/issues/6435
|
||||
const assignment = scheduled.find(({ paraId }) => paraId && paraId.eq(id));
|
||||
const assignment = scheduled.find(({ paraId }) => paraId?.eq(id));
|
||||
|
||||
if (!assignment) {
|
||||
return all;
|
||||
|
||||
@@ -35,7 +35,7 @@ function DeregisterId ({ className, nextParaId, onClose, ownedIds }: Props): Rea
|
||||
[]
|
||||
);
|
||||
|
||||
const isIdError = !paraId || !paraId.gt(LOWEST_INVALID_ID);
|
||||
const isIdError = !paraId?.gt(LOWEST_INVALID_ID);
|
||||
|
||||
const extrinsic = useMemo(() => api.tx.registrar.deregister(paraId), [api.tx.registrar, paraId]);
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ function RegisterThread ({ className, nextParaId, onClose, ownedIds }: Props): R
|
||||
[api, wasm, genesisState, paraConfig]
|
||||
);
|
||||
|
||||
const isIdError = !paraId || !paraId.gt(LOWEST_INVALID_ID);
|
||||
const isIdError = !paraId?.gt(LOWEST_INVALID_ID);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
|
||||
@@ -18,7 +18,7 @@ function useProposalImpl (id: ParaId, approvedIds: ParaId[], scheduled: Schedule
|
||||
id,
|
||||
isApproved: approvedIds.some((a) => a.eq(id)),
|
||||
isScheduled: scheduled.some(({ scheduledIds }) => scheduledIds.some((s) => s.eq(id))),
|
||||
proposal: opt && opt.isSome
|
||||
proposal: opt?.isSome
|
||||
? opt.unwrap()
|
||||
: undefined
|
||||
}),
|
||||
|
||||
@@ -84,7 +84,11 @@ function Teleport ({ onClose }: Props): React.ReactElement<Props> | null {
|
||||
|
||||
const call = useMemo(
|
||||
(): SubmittableExtrinsicFunction<'promise'> => {
|
||||
const m = XCM_LOC.filter((x) => api.tx[x] && isFunction(api.tx[x].limitedTeleportAssets))[0];
|
||||
const m = XCM_LOC.find((x) => api.tx[x] && isFunction(api.tx[x].limitedTeleportAssets));
|
||||
|
||||
if (!m) {
|
||||
throw new Error(`None of ${XCM_LOC.join(', ')} has limitedTeleportAssets`);
|
||||
}
|
||||
|
||||
return api.tx[m].limitedTeleportAssets;
|
||||
},
|
||||
|
||||
@@ -85,7 +85,7 @@ function createResult (bestNumber: BlockNumber, minContribution: BN, funds: Camp
|
||||
const hasNewTotalCap = !prev.totalCap.eq(totalCap);
|
||||
const hasNewTotalRaised = !prev.totalRaised.eq(totalRaised);
|
||||
const hasChanged =
|
||||
!prev.funds || prev.funds.length !== funds.length ||
|
||||
prev.funds?.length !== funds.length ||
|
||||
hasNewActiveCap || hasNewActiveRaised || hasNewTotalCap || hasNewTotalRaised ||
|
||||
funds.some((c) => isFundUpdated(bestNumber, minContribution, c, leased, prev));
|
||||
|
||||
|
||||
Reference in new issue
Block a user